Help on creating a "Shift to Sprint" script with animations?

sorry if this is a bad topic, i suck at creating topics.

  1. I need to create a movement/idle animation changer for my sprint script

  2. My movement/idle animation changer isn’t working

this is what i have in a local scipt at starterpack

char.Animate.walk.WalkAnim.AnimationId = "rbxassetid://7006481757" char.Animate.run.RunAnim.AnimationId = "rbxassetid://7006481757" char.Animate.idle.IdleAnim.AnimationId = "rbxassetid://7006517400"

full script:

local UserInputService = game:GetService("UserInputService")
local Players = game:GetService("Players")
local localPlayer = Players.LocalPlayer
local char = localPlayer.Character
UserInputService.InputBegan:Connect(function(input, gameProccesed)
	if gameProccesed then
		return
	else
		if input.KeyCode == Enum.KeyCode.LeftShift then
			humanoid = localPlayer.Character:WaitForChild("Humanoid")
			humanoid.WalkSpeed = 20
			char.Animate.walk.WalkAnim.AnimationId = "rbxassetid://7006481757"
			char.Animate.run.RunAnim.AnimationId = "rbxassetid://7006481757"
			char.Animate.idle.IdleAnim.AnimationId = "rbxassetid://7006517400"
		end
	end
end)
UserInputService.InputEnded:Connect(function(input, gameProccesed)
	if gameProccesed then
		return
	else
		if input.KeyCode == Enum.KeyCode.LeftShift then
			humanoid.WalkSpeed = 16
		end
	end
end)
1 Like

I’ve doned that before
I prefer loadanimation the player instead

You should do the WalkSpeed change on the server side.