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

Problems with creating a tool in game?

Asked by 9 years ago
local playername = Instance.new("Tool")

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 chicken = playername:Clone()
                chicken.Parent = game.Workspace
                chicken.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)

When I tested it in ROBLOX studio, the tool with the player's name was created perfectly fine. However, in-game, the tool seems to not be created whenever I call the function. Does anyone have a reason why it works in studio, but not in game? If so, could you correct the mistake in my script? Thanks in advance.

1 answer

Log in to vote
2
Answered by
Lucidic 15
9 years ago

I suggest going to the game on a ROBLOX server, and looking at the Developer Console (F9.) This may provide the solution.

0
If the F9 key doesn't show the Developer Console, then do this: Go to the Menu(Esc is shortcut), then Help, then you should see what I believe is Log and F9 should be visible, Click the button. alphawolvess 1784 — 9y
0
I don't see anything relating to the script.... poisonmonkey 30 — 9y
0
I found out the problem. Thanks for the advice. poisonmonkey 30 — 9y
Ad

Answer this question