Change animation when sprint

Hey! Recently tried to do an sprint system, But when the player sprints the animation dont change, This is my code

local Players = game:GetService("Players")
local StarterGui = game:GetService("StarterGui")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ReplicatedFirst = game:GetService("ReplicatedFirst")
local ServerStorage = game:GetService("ServerStorage")
local TweenService = game:GetService("TweenService")
local RunService = game:GetService("RunService")
local UserInputService = game:GetService("UserInputService")

local Player = game.Players.LocalPlayer.Character
local EventFolder = ReplicatedStorage.GameStructureEvents
local InfoPreset = TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut, 0, false, 0)

local IsRunning = false
local Human = Player:FindFirstChild("Humanoid")

-- This script was totally made by Kolda Studio's. --

UserInputService.InputBegan:Connect(function(input, gpe)
	if gpe then return end
	if input.KeyCode == Enum.KeyCode.LeftShift then
		if IsRunning == true then
			IsRunning = false
			Human.WalkSpeed -= 6
		elseif IsRunning == false then
			IsRunning = true
			Human.WalkSpeed += 6
		end
	end
end)
RunService.RenderStepped:Connect(function()
	if IsRunning == true then
		Player.Animate.walk.WalkAnim.AnimationId = "rbxassetid://15235476771"
	end
end)

(My game is R15)

1 Like