I have made an admin commands script. The shutdown command in the script works just fine! However, the kick command does not. I do not deal with strings very much, and I need a little bit of help on fixing this. I have tried this code to make it so when an admin types -kick "USER," it will kick the user from the game. Sadly, it will not work. Please help me in figuring this out!
local Owners = {"ChasingNachos"} local Prefix = "-" game.Players.PlayerAdded:Connect(function(plr) for i,v in pairs(Owners) do if plr.Name == v then plr.Chatted:Connect(function(Chat) if Chat:lower() == Prefix.. "shutdown" then for i,v in pairs(game.Players:GetPlayers()) do v:Kick("Server shutdown") end end if Chat:lower() == Prefix.. "kick" then for i,v in pairs(game.Players:GetPlayers()) do print("We received the players!") if string.match(string.sub(Chat,7), v.Name) then print("We made the string.") v:Kick("You have been kicked from this game.") print("The kick command works.") end end end end) end end end)
Please ignore the fact that everything is to the left. Again, the shutdown command works fine. The kick command does not work. There are no output errors.