For some odd reason the code that I use to play animations for my Player isn't working. Here is the script
local Player = game.Players.LocalPlayer local Mouse = Player:GetMouse() Mouse.KeyDown:connect(function(key) key = key:lower() if key == "g" then local anim = Player.Character.Humanoid:LoadAnimation(script.Animation) game:GetService("Chat"):Chat(Player.Character.Head, "BLESSED HAMMER!", "Blue") local x = game.ReplicatedFirst.Hammer.Handle:Clone() x.Parent = game.Workspace x.Name = "NotIceHammer" x.Anchored = false x.CanCollide = true x.CFrame=Player.Character.Head.CFrame*CFrame.new(0,6.5,4)*CFrame.Angles(0,math.pi/2,2*math.pi/9) local pe = Instance.new("ParticleEmitter", x) --Make the Hammer look Blessful-ly pe.Size = NumberSequence.new(0,2.62) pe.Texture = "rbxassetid://1205087993" pe.EmissionDirection = Enum.NormalId.Back pe.SpreadAngle = Vector2.new(0,360) pe.Lifetime = NumberRange.new(2.5) pe.Rate = 100 pe.LightEmission = 0.1 pe.Lifetime = NumberRange.new(.5) pe.Speed = NumberRange.new(.2) pe.Transparency = NumberSequence.new(.7) local bv = Instance.new("BodyVelocity", x) --To Counteract the gravity pulling the hammer down bv.MaxForce = Vector3.new(math.huge,math.huge,math.huge) bv.Velocity = Player.Character.Head.CFrame.upVector*0 local bv = Instance.new("BodyVelocity", x) bv.MaxForce = Vector3.new(math.huge,math.huge,math.huge) bv.Velocity = Player.Character.Head.CFrame.upVector*0 --Might Take Below Out-- while true do --Rotates it on its Z-Axis-- x.CFrame = x.CFrame * CFrame.fromEulerAnglesXYZ(0,0,0) wait(0.01) end --Might Take Above Out-- anim:Play() --Make The Hammer Follow the Humanoid's Arms-- end end)
The Animation Code used in this script is what I use for other scripts like this and they work just fine. I also have tried changing the Animation Priority to "Movement" and that didn't help either.
You have to actually PLAY the animation
local anim = Player.Character.Humanoid:LoadAnimation(script.Animation)
Instead of just making the animation a variable and not using it You have to play it like this
local anim = Player.Character.Humanoid:LoadAnimation(script.Animation) anim:Play()
And if its a looped animation you stop it like this
anim:Stop()