I made a sprinting script (a localscript in the PlayerGui) that makes you sprint with an animation when you double tap and hold the W key. A wierd thing is happening: when you stop holding W, your walk animation returns to normal, but only on the client side. On the server side, the sprint animation keeps going permanently
local plr = game.Players.LocalPlayer local char = plr.Character local UserInputService = game:GetService("UserInputService") local WTapped = false local Time = 0.15 local running = false UserInputService.InputBegan:Connect(function(Input, GameStuff) if GameStuff then return end if Input.KeyCode == Enum.KeyCode.W then if not WTapped then WTapped = true wait(Time) WTapped = false else while UserInputService:IsKeyDown(Enum.KeyCode.W) do if running == false then running = true char.Animate.walk.WalkAnim.AnimationId = "rbxassetid://3819460931" char.Humanoid.WalkSpeed = 25 end wait() end end end end) UserInputService.InputEnded:Connect(function(Input, GameStuff) if GameStuff then return end if Input.KeyCode == Enum.KeyCode.W and running == true then running = false char.Animate.walk.WalkAnim.AnimationId = "rbxassetid://180426354" char.Humanoid.WalkSpeed = 16 end end)
So it turns out I am not very smart... all I had to do was load the sprint animation and stop it
local plr = game.Players.LocalPlayer local char = plr.Character local UserInputService = game:GetService("UserInputService") local WTapped = false local Time = 0.15 local running = false UserInputService.InputBegan:Connect(function(Input, GameStuff) if GameStuff then return end if Input.KeyCode == Enum.KeyCode.W then if not WTapped then WTapped = true wait(Time) WTapped = false else while UserInputService:IsKeyDown(Enum.KeyCode.W) do if running == false then running = true char.Animate.walk.WalkAnim.AnimationId = "rbxassetid://3819460931" char.Humanoid.WalkSpeed = 25 end wait() end end end end) UserInputService.InputEnded:Connect(function(Input, GameStuff) if GameStuff then return end if Input.KeyCode == Enum.KeyCode.W and running == true then running = false char.Humanoid:LoadAnimation(script.running):Stop() --- << here is the solution char.Animate.walk.WalkAnim.AnimationId = "rbxassetid://180426354" char.Humanoid.WalkSpeed = 16 end end)