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

How Do You Make An Animation Run On Click Of A Tool?

I am trying to get my animation to run when a player activates the tool. I have tried many times and it has not worked. Local Script inside of the tool:

script.Parent.Equipped:Connect(function(Mouse) Mouse.Button1Down:Connect(function() animation = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Parent.Animation) animation:Play() end) end)

script.Parent.Unequipped:Connect(function() animation:Stop() end)

1 comment

0

FYI It runs the Animation thats inside of the tool.

1 answer

Try this idk

local animation
local mouse = game.Players.LocalPlayer:GetMouse()

script.Parent.Equipped:Connect(function()
	mouse.Button1Down:Connect(function() 
		animation = 											 
        game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Parent.Animation) 
		animation:Play() 
	end)
end)

script.Parent.Unequipped:Connect(function() 
	animation:Stop() 
end)

4 comments

0

Does it have to be R6?

0

should work with both

0

Does it work with meshes

0

its just your script but added onto

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