✓ Accepted answer
Connect the function to Player.Chatted event, where the first parameter is the message of the player who chatted.
NOTE: Changing a property in a LocalScript will not cause any changes on the server, thus other clients can't see that the BrickColor of the part has been changed. Also, BrickColor is not a property of Workspace.
To make it work in a LocalScript, first you have to specify who would you like to check. Then create a Chatted event to their Player object in order to check if the specified player is sending the corresponding message.
Here's the full demonstration on how to use it:
local plrs = game.Players
local localplr = plrs.LocalPlayer
local name = "NotKeanuReeves"
local plr = game.Players[name]
plr.Chatted:Connect(function(msg)
if msg == "you big noob" then
workspace.PartToChangeColor.BrickColor = BrickColor.Random()
end
end)
3 comments
Thank you so much, also "you big noob" xD
how dare u insult me ima repot!!!1!!1!
xD