This may sound like a rather stupid question, I used to know this but now I've forgotten
If I wanted to print "Hi" when I press a button I would just type:
Button.Touched:Connect(function()
print("Hi")
end)
But, if I wanted the game to print "Hi" when the player types and enters something in the chat box, how would I implement such a thing?
There's an event for that.
It's Chatted event and it's fired when a player uses the chat bar.
Here's an example on how to use it:
game.Players.PlayerAdded:Connect(function(player) player.Chatted:Connect(function(message) --message he sent is the first parameter print(player.Name.." says: "..message) --do stuff end) end)
Chat box? Do you mean like Text box or the chat?
If it's Text box, use this code:
TextBox.Changed:Connect(function(property) -- When the properties of the textbox changed if property == "Text" then -- If the property is text then print("hi") -- hi end end
If it's chat, use this code:
game.Players.PlayerAdded:Connect(function(player) -- When a player joined player.Chatted:Connect(function(message) -- When the player chatted print("hi") -- hi end) end)