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

When clicked, why doesn't it remove your tool?

toolname = "LinkedSword" 


Tool = true 
game.Players.PlayerAdded:connect(function(newPlayer)
newPlayer.CharacterAdded:connect(function(char)
script.Parent.ClickDetector.MouseClick:connect(function()
if Tool == false then return end 
wait()
Tool = game.Lighting:findFirstChild(Toolname):remove()
Tool.Parent = game.Players:findFirstChild(char.Name).Backpack
game.Players.PlayerAdded:connect(function(Player)
    Player.CharacterAdded:connect(function(Char)
        if Player.Backpack:findFirstChild(Toolname) then
            Player.Backpack:findFirstChild(Toolname):remove()
end
end)

Could you help me please?

1 comment

0

You are missing an end, also use Destroy

1 answer

✓ Accepted answer

Problems

You're using remove(), use Destroy()!

You forgot an end.


Fixes

Replaced your removes with Destroy()

Added an end


Script

toolname = "LinkedSword" 
Tool = true 

game.Players.PlayerAdded:connect(function(newPlayer)
	newPlayer.CharacterAdded:connect(function(char)
		script.Parent.ClickDetector.MouseClick:connect(function()
			if Tool == false then return end 
			wait()
			Tool = game.Lighting:findFirstChild(Toolname):Destroy()
			Tool.Parent = game.Players:findFirstChild(char.Name).Backpack
			game.Players.PlayerAdded:connect(function(Player)
    			Player.CharacterAdded:connect(function(Char)
        			if Player.Backpack:findFirstChild(Toolname) then
            			Player.Backpack:findFirstChild(Toolname):Destroy()
					end
				end)
			end)
		end)
	end)	
end)

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