Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Problems with creating a tool in game?

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

✓ Accepted answer

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

3 comments

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.

0

I don't see anything relating to the script....

0

I found out the problem. Thanks for the advice.

This discussion is preserved as it was. New answers, comments, and votes are closed.