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

How do I make a function work when a tool is UnEquipped?

I tried this script:

tool = script.Parent.Parent
player = game.Players.LocalPlayer
pm = player:GetMouse()

tool.Equipped:connect(function(mouse)
	game.ReplicatedStorage.Kill:Clone().Parent = player.PlayerGui
end)

tool.UnEquipped:connect(function(mouse)
	player.PlayerGui.Kill:Destroy()
end)

1 answer

Careful; capitalization error. Remember that programming languages are case-sensitive. This is due to the fact that it was made to be as compact as possible, leaving less room for redundancy.

Unequipped Event

tool.Unequipped:connect(function ()
	player.PlayerGui.Kill:Destroy()
end)

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