Hey there, I want to make it so when players press Shift they can sprint with a sprinting animation.
The problem is when playing and pressing Shift it makes players faster but does not do the animation and the Output does not provide and errors.
The LocalScript is located inside StarterCharacterScripts
The Script:
In Game:
Output:
The Scripts Code:
local UserInputService = game:GetService("UserInputService")
local Players = game:GetService("Players")
local player = Players.LocalPlayer
UserInputService.InputBegan:Connect(function(input, gameProccesed)
if gameProccesed then
return
else
if input.KeyCode == Enum.KeyCode.LeftShift then
humanoid = player.Character:WaitForChild("Humanoid")
humanoid.WalkSpeed = 26
player.Character.Animate.run.RunAnim.AnimationId = "rbxassetid://8552977429" --RunAnimation
end
end
end)
UserInputService.InputEnded:Connect(function(input, gameProccesed)
if gameProccesed then
return
else
if input.KeyCode == Enum.KeyCode.LeftShift then
humanoid.WalkSpeed = 16
player.Character.Animate.run.RunAnim.AnimationId = "rbxassetid://8552975446" --WalkAnimation
end
end
end)
I have looked a few places and couldn’t find a working soloution, So i came here.