i wanted to play animation1 first then animation and then again animation1 as i am making a sword
local plr = game.Players.LocalPlayer local character = plr.Character or plr.CharacterAdded:Wait() local humanoid = character:WaitForChild("Humanoid") local sound = script.Parent.Handle.OverheadSound local sound2 = script.Parent.Handle.UnsheathSound local animations = "rbxassetid://6779827280" local animation1 = "rbxassetid://6780070275" local animationplayer = script.Parent.Handle.Animation local CanAttack = true script.Parent.Activated:connect(function() if animationplayer.AnimationId == animation1 then CanAttack = false animation1:Play() animationplayer.AnimationId = animations wait(0.2) CanAttack = true else CanAttack = false animations:Play() animationplayer.AnimationId = animation1 wait(0.2) CanAttack = true end end) local idelanim = script.Parent.Handle.asd local idealanimation = humanoid:LoadAnimation(idelanim) script.Parent.Equipped:Connect(function() idealanimation:Play() sound2:Play() end) script.Parent.Unequipped:Connect(function() idealanimation:Stop() end)
Hello, this is how we properly load and play animations.
local player = game.Players.LocalPlayer --gets the player local character = player.Character or player.CharacterAdded:Wait() --gets its character local humanoid = character:WaitForChild("Humanoid") --gets the humanoid local animator = humanoid:WaitForChild("Animator") --gets the animator local animation = character.Animation --gets the animation object (ofcourse, change it to your animation's address) local animTrack = animator:LoadAnimation(animation) --loads the animation so we can play it animTrack:Play() --plays the animation
What you were doing was playing strings
instead of AnimationTrack
s. I hope this makes sense, good luck!
I'm not an animations specialist though, I still know you need to make an animation in order to play it.
local animation1In = Instance.new(Animation) animation1In.AnimationId = animation1 --install this somewhere between the variables and where you call it, yet still on global scope. --and rewrite animation1 into animation1In in line 16
i moved to python half a year ago if I messed up something terribly sorry!