RobloxScripterAI
Discord ↗
Link Copied to Clipboard
×
"make a shift to sprint that plays a sprint animation"
-- local script local UserInputService = game:GetService("UserInputService") local Players = game:GetService("Players") local player = Players.LocalPlayer local character = player.Character local humanoid = character:WaitForChild("Humanoid") local sprinting = false local sprintAnimation = Instance.new("Animation") sprintAnimation.AnimationId = "rbxassetid://your_animation_id_here" -- replace with your sprint animation id local sprintAnimTrack = humanoid:LoadAnimation(sprintAnimation) UserInputService.InputBegan:Connect(function(input) if input.KeyCode == Enum.KeyCode.LeftShift then sprinting = true humanoid.WalkSpeed = 50 sprintAnimTrack:Play() end end) UserInputService.InputEnded:Connect(function(input) if input.KeyCode == Enum.KeyCode.LeftShift then sprinting = false humanoid.WalkSpeed = 16 sprintAnimTrack:Stop() end end)