trying to make it so that when you press shift you sprint and it runs the sprint animation, the speed increases but animation wont play
I have this in statercharacterscripts
local UserInputService = game:GetService("UserInputService")
local Players = game:GetService("Players")
local Player = Players.LocalPlayer
local BaseSpeed = 16
local SprintSpeed = 30
local sprintAnim = "rbxassetid://140391691616690"
local function setupCharacter(character)
local Humanoid = character:WaitForChild("Humanoid")
local AnimateScript = character:WaitForChild("Animate")
local normalRunAnim = AnimateScript.run.RunAnim.AnimationId
local function startSprint()
Humanoid.WalkSpeed = SprintSpeed
AnimateScript.run.RunAnim.AnimationId = sprintAnim
end
local function stopSprint()
Humanoid.WalkSpeed = BaseSpeed
AnimateScript.run.RunAnim.AnimationId = normalRunAnim
end
UserInputService.InputBegan:Connect(function(input, gameProcessed)
if gameProcessed then return end
if input.KeyCode == Enum.KeyCode.LeftShift then
startSprint()
end
end)
UserInputService.InputEnded:Connect(function(input, gameProcessed)
if input.KeyCode == Enum.KeyCode.LeftShift then
stopSprint()
end
end)
Humanoid.Died:Connect(function()
stopSprint()
end)
end
Player.CharacterAdded:Connect(setupCharacter)
if Player.Character then
setupCharacter(Player.Character)
end
** You are now Level 1! **