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.
I suggest going to the game on a ROBLOX server, and looking at the Developer Console (F9.) This may provide the solution.