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

Gear with Custom Animations to Play on Mouseclick?

Alright, so I'm not even sure if this website is even active anymore but I'm still needing desperate help.

So I'm creating this gear that uses the players hands to spin on a rapid rate to act as a wind tunnel that blows away other players, similar to the blowdryer gear. Anyways, I've already created the animation for the hand spin but I can't seem to incorporate the animation into the gear and so that it plays only when the mouse is clicked and is held down. The gear is a tool not a hopperbin. This is a script that I've tried using from other players but nothing works for this either way.

Could someone please help me.

Tool = script.Parent
local player = game.Players.LocalPlayer
repeat wait() until player.Character ~= nil
local hum = player.Character:WaitForChild("Humanoid")

local animation = Tool.TornadoArms 
local AnimTrack = hum:LoadAnimation(animation) 
Tool.Activated:connect(function(mouse) 
        AnimTrack:Play()
    end)

Tool.Unequipped:connect(function()
    AnimTrack:Stop()
end)

Still requiring assistance. :(

1 comment

0

Help still? :(

1 answer

✓ Accepted answer

You can connect it to the Deactivated event of the Tooland Stop the animation.

Tool = script.Parent
local player = game.Players.LocalPlayer
repeat wait() until player.Character ~= nil
local hum = player.Character:WaitForChild("Humanoid")

local animation = Tool.TornadoArms 
local AnimTrack = hum:LoadAnimation(animation) 
Tool.Activated:connect(function(mouse) 
    AnimTrack:Play()
end)

Tool.Deactivated:connect(function(mouse) 
    AnimTrack:Stop()
end)

Tool.Unequipped:connect(function()
    AnimTrack:Stop()
end)

1 comment

0

Thanks a ton man! This helped a lot! You helped me in comments as well! Thanks so much!

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