--// SETTINGS local WALK_SPEED = 7 local SPRINT_SPEED = 28 local RUN_ANIM_SPEED = 3 --// REFERENCES local player = game.Players.LocalPlayer --// GUI SETUP local gui = Instance.new("ScreenGui") gui.Name = "SprintGui" gui.ResetOnSpawn = false gui.Parent = player:WaitForChild("PlayerGui") local button = Instance.new("TextButton") button.Size = UDim2.new(0, 120, 0, 120) button.Position = UDim2.new(1, -140, 1, -180) button.BackgroundColor3 = Color3.fromRGB(30, 30, 30) button.BackgroundTransparency = 0.2 button.TextColor3 = Color3.new(1, 1, 1) button.TextScaled = true button.Text = "SPRINT" button.Parent = gui local corner = Instance.new("UICorner", button) corner.CornerRadius = UDim.new(1, 0) --// CHARACTER SETUP local sprinting = false local humanoid local function updateAnimationSpeed() if not humanoid then return end for _, track in pairs(humanoid:GetPlayingAnimationTracks()) do if track.Name:lower():find("run") then track:AdjustSpeed(sprinting and RUN_ANIM_SPEED or 1) end end end local function applySpeed() if humanoid then humanoid.WalkSpeed = sprinting and SPRINT_SPEED or WALK_SPEED updateAnimationSpeed() end end local function setupCharacter(char) humanoid = char:WaitForChild("Humanoid") sprinting = false -- whenever a new animation plays, update it if sprinting humanoid.AnimationPlayed:Connect(function(track) if track.Name:lower():find("run") then track:AdjustSpeed(sprinting and RUN_ANIM_SPEED or 1) end end) applySpeed() end -- initial + respawn if player.Character then setupCharacter(player.Character) end player.CharacterAdded:Connect(setupCharacter) --// BUTTON LOGIC button.MouseButton1Click:Connect(function() sprinting = not sprinting button.Text = sprinting and "SPRINT: ON" or "SPRINT" applySpeed() end)