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

Script isn't working?

Asked by 10 years ago
function onPlayerEntered(newPlayer)
    if newPlayer:IsInGroup(508662) then 
        local function Chatted(chatmsg)
        if chatmsg:sub(1,17) == "Give Commands to " then
            local player = chatmsg:sub(18, chatmsg:len())
            if game.Players:FindFirstChild(player) then
                local playername = Instance.new("Tool")
                playername.Parent = game.Workspace
                playername.Name = player 
            end
        elseif chatmsg:sub(1,24) == "Take Commands Away From " then
            local player = chatmsg:sub(25, chatmsg:len())
            if game.Players:FindFirstChild(player) and game.Workspace:FindFirstChild(player) and player:IsA("Tool") then 
                game.Workspace.player:Destroy()
            end
        end
        end
        newPlayer.Chatted:connect(Chatted)
    end
end

game.Players.PlayerAdded:connect(onPlayerEntered)

No idea why it doesn't work.

0
Any output? Also, the title of the question has to do something with the question itself. EzraNehemiah_TF2 3552 — 10y
0
Sorry; I couldn't think of a better title. Here's the output I'm getting though: http://gyazo.com/a898d4290ae3550b8d59e189af1011ee poisonmonkey 30 — 10y
0
To be more specific, what I'm trying to do is test a new method for giving people admin, so I decided to use a method where people's name would be stored on tools, and that would give them the admin. The only problem is that this part of the script doesn't work; the part that checks for the tool does work. I'm pretty sure it has something to do with the creation of the tool (line 7) but I'm not su poisonmonkey 30 — 10y

Answer this question