This is the script I have right now, but it doesn't change the run animation when clicked. What am I doing wrong?
1 | script.Parent.MouseButton 1 Click:connect( function (p) |
2 | p.Character.Animate.run.RunAnim.AnimationId = "http://www.roblox.com/asset?id=1889592040" |
3 | end ) |
1 | local animation = Instance.new( "Animation" ) |
2 | animation.AnimationId = "http://www.roblox.com/asset?id=1889592040" |
3 | script.Parent.MouseButton 1 Click:connect( function () |
4 | local animTrack = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(animation) |
5 | animTrack:Play() |
6 | end ) |
I stole the scripting from the Roblox wiki, so I'm not 100% sure it'll work.
I fixed it, this should work:
1 | script.Parent.MouseButton 1 Click:connect( function (p) |
2 | local AnimationId = "1889592040" --set animation id here |
3 | local Anim = Instance.new( "Animation" ) |
4 | Anim.AnimationId = "rbxassetid://" ..AnimationId |
5 | local k = p.Character.Humanoid:LoadAnimation(Anim) |
6 | k:Play() |
7 | k:AdjustSpeed( 2 ) --set animation speed here |
8 | end ) |
Tell me if it's broken or not.