How can I make a script where I can chat a command, like in admin commands, and the command does a kind of function, like when in Person299's admin commands when you say 'kill/plr' and it kills a player, how can I make a script like that?
game.Players.PlayerAdded:connect(function(plr) -- if admin if plr.Name == "p00pser" then plr.chatted:connect(function(msg) if msg:lower():sub(1,--[[how long it is]]5) == "derp/" then local plr = game.Players:findFirstChild(msg:lower():sub(6--[[how long it is+1]])) plr.Character.Humanoid.Health = 0 end end) end end)
and yes I just made this script here
You will need to use the PlayerAdded
event. The Chatted
event. After you get the message you will have to use string manipulation to dissect the message.
Game.Players.PlayerAdded:connect(function(Player) --Check for specific names here if wanted. Player.Chatted:connect(function(msg) if msg == "bob" then -------------- end end) end)
Locked by TheeDeathCaster
This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.
Why was this question closed?