Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why wont this admin script work? [closed]

Asked by 8 years ago

It does everything but kill the player. I want it so that you don't need to type the full name of a player, but obviously I have failed.

players = game:GetService("Players")
admins = {["Player"] = true ; }

players.PlayerAdded:connect(function(newPlayer)
    if admins[newPlayer.Name] then
        newPlayer.Chatted:connect(function(msg, speaker)
            if string.sub (msg, 1, 6) == ":kill " then
                for _,v in pairs (players:GetPlayers()) do
                    if v.Name:match(string.lower(msg, 6, string.len(msg))) then
                        v.Character.Humanoid.Health = 0
                    end
                end
            end
        end)
    end
end)

Closed as Not Constructive by Unclear

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?