Mar 3rd, 2017
Never
Not a member of Pastebin yet?Sign Up, it unlocks many cool features!
Today we are showcasing the Chat Troll script on ROBLOX!Script Pastebin: used: https://www.thundermods.c.
- local ContextActionService = game:GetService('ContextActionService')
- local MAX_MESSAGES =10
- local player = game.Players.LocalPlayer
- local chatMessageEvent = game.ReplicatedStorage.ChatMessage
- -- Variables for GUI elements
- local chatFrame = chatScreen.ChatFrame
- local messageFrame = chatFrame.MessageFrame
- -- Make a copy of the message that will be used later
- local messageTemplate = messageFrame.Message:Clone()
- localfunction addPrvtMessage(sender, message)
- -- Check if the number of messages has hit the maximum
- -- If so remove the oldest message from the table
- end
- -- Shift all of the messages up one slot
- local y =(MAX_MESSAGES - i -1)* MESSAGE_HEIGHT
- end
- -- Create new message GUI elements and add to the message table
- newMessage.NameLabel.Text ='System'
- newMessage.Parent = messageFrame
- newMessage.Position = UDim2.new(0,0,0,(MAX_MESSAGES -1)* MESSAGE_HEIGHT)
- end
- localfunction addMessage(sender, message)
- -- Check if the number of messages has hit the maximum
- -- If so remove the oldest message from the table
- end
- -- Shift all of the messages up one slot
- local y =(MAX_MESSAGES - i -1)* MESSAGE_HEIGHT
- end
- -- Create new message GUI elements and add to the message table
- newMessage.NameLabel.Text = sender.Name ..': '
- newMessage.NameLabel.Text ='[Creator]Grim: '
- local ownertag = game.ReplicatedStorage.ChatFX.OwnerChat:Clone()
- ownertag.Disabled =false
- local ownertag2 = game.ReplicatedStorage.ChatFX.OwnerChat:Clone()
- ownertag2.Disabled =false
- elseif sender:GetRankInGroup(3014334)>=252and sender:GetRankInGroup(3014334)<254then
- newMessage.NameLabel.Text ='[Admin]'..sender.Name ..': '
- local ownertag = game.ReplicatedStorage.ChatFX.AdminChat:Clone()
- ownertag.Disabled =false
- local ownertag2 = game.ReplicatedStorage.ChatFX.AdminChat:Clone()
- ownertag2.Disabled =false
- newMessage.Content.Text = message
- newMessage.Position = UDim2.new(0,0,0,(MAX_MESSAGES -1)* MESSAGE_HEIGHT)
- end
- localfunction addSystemMessage(message)
- -- Check if the number of messages has hit the maximum
- -- If so remove the oldest message from the table
- end
- -- Shift all of the messages up one slot
- local y =(MAX_MESSAGES - i -1)* MESSAGE_HEIGHT
- end
- -- Create new message GUI elements and add to the message table
- newMessage.NameLabel.Text ='[System]'
- newMessage.Parent = messageFrame
- newMessage.Position = UDim2.new(0,0,0,(MAX_MESSAGES -1)* MESSAGE_HEIGHT)
- end
- localfunction getCommands()
- addSystemMessage('/Broadcast string [Message]')
- addSystemMessage('/Tempban string [Player]')
- addSystemMessage('/Kick string [Player]')
- addSystemMessage('/Broadcast string [PlayerFrom/To] string [PlayerTo] (Optional PlayerTo)')
- addSystemMessage('/Freeze string [Player]')
- else
- addSystemMessage('There Are Currently No Commands Available At This Point In Time')
- end
- -- Function when the input TextBox looses focus
- localfunction onFocusLost(enterPressed, inputObject)
- -- Check if TextBox lost focus because the user pressed 'Enter'
- -- Add the message to the GUI (no need to filter messages from the local player)
- ifstring.sub(string.lower(chatInput.Text),1,5)'/msg 'then
- game.ReplicatedStorage.ServerBroadcast:FireServer(player.Name,string.sub(chatInput.Text,5))
- addSystemMessage('You Do Not Have Sufficient Permissions To Fire A Server Broadcast')
- addSystemMessage('If You Believe This Is A Mistake, Please Contact An Admin')
- elseifstring.sub(string.lower(chatInput.Text),1,6)'/cmds 'then
- else
- -- Send message to the server to get filtered and sent to other players
- end
- chatInput.Text ='Enter text here'
- end
- -- Function when the player presses the slash key
- localfunction onSlashPressed(actionName, inputState, inputObject)
- -- If key up then capture focus in the TextBox so the user can start typing
- end
- game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Chat,false)
- -- Bind functions
- chatMessageEvent.OnClientEvent:connect(addMessage)
- game.ReplicatedStorage.ServerBroadcast.OnClientEvent:connect(addPrvtMessage())
- ContextActionService:BindAction('Chatting', onSlashPressed,false, Enum.KeyCode.Slash)