How to change the color of a scripts parent when a player says something

Hey Devs, another noobie script question that’s kinda stumping me:

How do I make the parent of a script (for example if it’s a simple brick), change color when they player says something. For example, if the player says “red” the brick should turn red and so on…

This should work properly.
Just put it inside a server-side script inside a brick.
You have to use small/upper cases correctly when typing in chat.

game.Players.PlayerAdded:Connect(function(Player)
	Player.Chatted:Connect(function(msg)
		local color
		
		pcall(function()
			color = BrickColor[msg]()
		end)

		if color then
			script.Parent.BrickColor = color
		end
	end)
end)
1 Like