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

Help fix this script to only occur when the tool is equipped?

player = game.Players.LocalPlayer

mouse = player:GetMouse()

animation = script:WaitForChild("Animation")

enabled = true

mouse.Button1Down:connect(function() if enabled then enabled = false

	local animationTrack = player.Character.Humanoid:LoadAnimation(animation)
	animationTrack:Play()
	
	wait(3)
	enabled = true
	
	animation:Stop()

end

end)

3 comments

0

Idk why the script seperated. Sorry.

0

Use .Equipped

0

Where should I write that?

1 answer

✓ Accepted answer

You put enabled to true at the start.

To make this script occur only when the tool is equipped, try this :

equipped = false

script.Parent.Equipped:connect(function()
	equipped = true
end

This is what i do with my scripts and it works.

2 comments

0

for the script.parent part..do I put the name of the script or the name of the tool it is in? loulou112

0

Where do I paste in my script? It doesn't work when I paste it in the beginning. loulou112

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