Here's the script
01 | local Player = game.Players.LocalPlayer |
02 | local Character = Player.Character |
03 | local Humanoid = Character:WaitForChild( "Humanoid" ) |
04 | local Animate = Character:WaitForChild( "Animate" ) |
05 | local Animation = script.Parent:WaitForChild( "Anim" ) |
06 | local Anim = Animation.AnimationId |
07 | local Original = Animate.walk.WalkAnim.AnimationId |
08 | local Running = script.Parent:WaitForChild( "Running" ) |
09 |
10 | Running.Changed:Connect( function () |
11 |
12 | print ( "Doing Stuff" ) |
13 |
14 | if Humanoid.MoveDirection.Magnitude > 0 and Running.Value = = true then |
15 |
The problem is that the animations aren't loading correctly, if you want to play the sprint animation, You can't do it while walking, You have to press shift before you start walking. If you want to stop the animation, you have to stop walking.
I've tried multiple scripts to do this.. But the problem isalways the same, The animations have trouble playing.
You can change the Run animation of the character and the Walk animation if you want by going into the characters through a script and changing its animation settings.
1 | local plr = game.Players.LocalPlayer |
2 | local char = plr.Character |
3 | local Anims = char.Animate |
4 | local RunAnim = Anims.run.RunAnim |
5 |
6 | RunAnim.AnimationId = "http://www.roblox.com/asset/?id=YOURID" |
if you want to change it permanently you can add this script to StarterCharacterScripts and change the animation so anytime that the player runs its animation should be changed already and you wont have to do it everytime they press shift, and roblox automatically decides when to play the run anim for you.
I solved it! All I had to do was mae it so that the animation is loaded, played and immediatelly stopped, and let the animate script do the rest.
01 | local Player = game.Players.LocalPlayer |
02 | local Character = Player.Character |
03 | local Humanoid = Character:WaitForChild( "Humanoid" ) |
04 | local Animate = Character:WaitForChild( "Animate" ) |
05 | local Animation = script.Parent.Anim |
06 | local Anim = Animation.AnimationId |
07 | local OriginalAnim = Animate.walk.WalkAnim |
08 | local Original = Animate.walk.WalkAnim.AnimationId |
09 | local Running = script.Parent:WaitForChild( "Running" ) |
10 |
11 | Running.Changed:Connect( function () |
12 |
13 | print ( "Doing Stuff" ) |
14 |
15 | if Humanoid.MoveDirection.Magnitude > 0 and Running.Value = = true then |
Thanks to everyone who tried helping, even though You did not solve it, I really appreciate it!