So, basically I am trying to make a admin command but whenever I say "game.Players.LocalPlayer.Name" it always get a error called "attemp to index nil with "Name""
Here is the whole code:
local prefix = "/" local targettokick local admins = {"scooter369","airstrike0103"} game.Players.PlayerAdded:Connect(function(player) player.Chatted:Connect(function(message) local messagesplit = message:split(" ") local splittoo = messagesplit[1]:split("/") splittoo[2] = string.lower(splittoo[2]) if splittoo[2] == "kick" then for i, v in pairs(admins) do if game.Players.LocalPlayer.Name == v then print("Player admin") else print("player not admin") end end targettokick = messagesplit[2] if game.Players:FindFirstChild(targettokick) then game.Players[targettokick]:Kick("You have been kicked from the game..") end end end) end)
If you want to get in the line where I get the error, Go to line 15..
help pls