I've tried this,
handle = script.Parent.Handle
Weapon.Equipped:connect(function(mouse)
handle.idle:Play()
end)
This script works fine when playing a sound but I haven't been able to get it to work with animations.
I've tried this,
handle = script.Parent.Handle
Weapon.Equipped:connect(function(mouse)
handle.idle:Play()
end)
This script works fine when playing a sound but I haven't been able to get it to work with animations.
Animations are a bit different. You need to load animations into the Players Humanoid.
LocalScript:
repeat wait() until game.Players.LocalPlayer.Character
local Player = game.Players.LocalPlayer
local anim = Player.Character.Humanoid:LoadAnimation(script.Animation)
local tool = script.Parent
tool.Equipped:connect(function()
wait(0.5)
anim:Play()
wait(1.5)
anim:Stop()
end)
Please accept this answer if it solved your problem, thanks!
That script does not work. It's because of the fact that the Repeat requires an Until for it to work.
Oops, my bad, must've forgot that. Kind of wrote it in a haste.
That's alright, I kinda sorta figured it out.
This discussion is preserved as it was. New answers, comments, and votes are closed.
2 comments
Has the animation got an ID? And are you giving the tool enough time to load the animation?
Use the humanoid:LoadAnimation(animation) function on the humanoid first.