I’m trying to make a script that changes the players color rapidly when you send a message with a certain string in chat , using the PlayerSay and Think hooks (Linked Above)
I want to make one function call another function if a certain condition is met , in this case i want the color of all players to be changed if someone includes “!ColorChange” in chat.
function colorchange(ply , ent) for k ,v in pairs(player.GetAll()) do local r = math.random(1,255) local g = math.random(1,255) local b = math.random(1,255) v:SetColor(Color(r,g,b)) end end function chatcommand(ply , text , team) if text == "!ColorChange" then end end hook.Add("Think" , "ColorChange" , colorchange) hook.Add("PlayerSay" , "ChatCommand" , chatcommand)
If anyone knows how i could call the function “colorchange” in the function “chatcommand” i would be greatful.
Thanks In Advance.