How do I stop this from working after I unequip it?
This is a tool that pulls things towards you when you click on them. My problem is that it keeps working even after I unequip the tool. How do I fix it?
01 | player = game.Players.LocalPlayer |
02 | mouse = player:GetMouse() |
06 | script.Parent.Equipped:Connect( function () |
07 | mouse.Button 1 Down:connect( function () |
09 | mouse.TargetFilter = game.Workspace:FindFirstChild( "7" ) |
11 | if debounce = = true then |
12 | if mouse.Target.Anchored = = false and mouse.Target.Name = = "Part" then |
15 | local Sound = Instance.new( "Sound" , mouse.Target) |
18 | if not Sound.IsPlaying then |
23 | local rp = Instance.new( "RocketPropulsion" , mouse.Target) |
24 | mouse.Target.Anchored = false |
26 | rp.Target = player.Character.Torso |
28 | local distance = (mouse.Target.Position - player.Character.Torso.Position).Magnitude |
30 | mouse.Target.Touched:connect( function (hit) |
31 | hit = hit.Parent:FindFirstChild( "Humanoid" ) |
48 | script.Parent.Unequipped:Connect( function () |