local moving = false local player = game.Players.LocalPlayer local character = player.Character or player.CharacterAdded:Wait() local humanoidRootPart = character:WaitForChild("HumanoidRootPart") local humanoid = character:WaitForChild("Humanoid") local runService = game:GetService("RunService") local userInputService = game:GetService("UserInputService") local movementSpeed = 125 local animation = Instance.new("Animation") animation.AnimationId = "rbxassetid://18897115785" local animator = humanoid:FindFirstChildOfClass("Animator") or humanoid:WaitForChild("Animator") local animationTrack local function moveForward() while moving do local forwardDirection = humanoidRootPart.CFrame.LookVector humanoidRootPart.Velocity = forwardDirection * movementSpeed runService.Stepped:Wait() end end local function onInputBegan(input, gameProcessed) if input.KeyCode == Enum.KeyCode.LeftControl and not gameProcessed then moving = true animationTrack = animator:LoadAnimation(animation) animationTrack:Play() moveForward() end end local function onInputEnded(input, gameProcessed) if input.KeyCode == Enum.KeyCode.LeftControl and not gameProcessed then moving = false if animationTrack then animationTrack:Stop() end end end userInputService.InputBegan:Connect(onInputBegan) userInputService.InputEnded:Connect(onInputEnded)