if not game.Players.LocalPlayer.Character then wait() end local UIS = game:GetService("UserInputService") local plr = game.Players.LocalPlayer local chr = plr.Character while true do walkAnim = chr.Animate.walk.WalkAnim runAnim = chr.Animate.run.RunAnim UIS.InputBegan:connect(function(key) if key.KeyCode == Enum.KeyCode.LeftShift then chr.Humanoid.WalkSpeed = 24 chr.Humanoid:LoadAnimation(runAnim) end end) UIS.InputEnded:connect(function(key) if key.KeyCode == Enum.KeyCode.LeftShift then chr.Humanoid.WalkSpeed = 12 chr.Humanoid:LoadAnimation(walkAnim) end end) wait() end
I feel like this script should work, I have the animation Ids right, so I do not know what the problem is. It is just running the Walk animation. It still changes WalkSpeed though. I set the Run animation to an id, instead of it being run.xml or whatever it usually is. Maybe the problem is in the animation script and not this, I dunno...
The script needs to be a regular script, and because it needs to be a ordinary script, the script has to be fitted for a ordinary script. Below will be your script, that I have fixed.
-- //Put this in StarterCharacterScripts local UIS = game:GetService("UserInputService") local plr = game.Players:GetPlayerFromCharacter(script.Parent) local chr = plr.Character while true do walkAnim = chr.Animate.walk.WalkAnim runAnim = chr.Animate.run.RunAnim UIS.InputBegan:connect(function(key) if key.KeyCode == Enum.KeyCode.LeftShift then chr.Humanoid.WalkSpeed = 24 chr.Humanoid:LoadAnimation(runAnim) end end) UIS.InputEnded:connect(function(key) if key.KeyCode == Enum.KeyCode.LeftShift then chr.Humanoid.WalkSpeed = 12 chr.Humanoid:LoadAnimation(walkAnim) end end) wait() end