Alright, so the other day I thought it would be fun to make my own personal admin system. For no one else's use except mine. So, I made the first basic command and I'm already hitting a blockade. For some reason, this isn't working and I'm not quite sure why. Here's my script:
repeat wait() until game.Players.LocalPlayer.Character Player = game.Players.LocalPlayer Char = Player.Character Player.Chatted:connect(function(Message) local Length = string.len(Message) print(Length) if Message:sub(1, 15) == "System Command:" then print("First Step") if Message:sub(17, 20) == "Kill" then print("Second Step") local Target = Message:sub(21) game.Workspace:FindFirstChild(Target).Torso:Remove() end end end)
So this SAO-esque script is actually a LocalScript
in StarterPack
This is the error I'm getting:
https://gyazo.com/65e08ad8cf12b208820d0ba09765b857 (The link function wouldn't work/is broken)
~~Thanks in advance~~
Well, unless you want the command to be "System Command: KillSnaz_X", you're gonna need to change Target to "Message:sub(22)". Also, it'll look better if you just take all the health from the humanoid:
repeat wait() until game.Players.LocalPlayer.Character Player = game.Players.LocalPlayer Char = Player.Character Player.Chatted:connect(function(Message) local Length = string.len(Message) print(Length) if Message:sub(1, 15) == "System Command:" then print("First Step") if Message:sub(17, 20) == "Kill" then print("Second Step") local Target = Message:sub(22) game.Workspace:FindFirstChild(Target)["Humanoid"].Health = 0 end end end)
Now, Just say "System Command: Kill Snaz_X" and your character will die.