-- LocalScript (StarterPlayerScripts) local Players = game:GetService("Players") local UserInputService = game:GetService("UserInputService") local RunService = game:GetService("RunService") local player = Players.LocalPlayer -- Setup character/humanoid local character = player.Character or player.CharacterAdded:Wait() local humanoid = character:WaitForChild("Humanoid") -- Defaults local desiredWalkSpeed = 32 local defaultWalkSpeed = humanoid.WalkSpeed local walkSpeedLocked = true local toggleKey = Enum.KeyCode.RightControl local waitingForKeyInput = false -- === GUI === local gui = Instance.new("ScreenGui") gui.Name = "WalkSpeedGui" gui.ResetOnSpawn = false gui.Parent = player:WaitForChild("PlayerGui") local frame = Instance.new("Frame") frame.Size = UDim2.fromOffset(300, 150) frame.Position = UDim2.new(0.5, -150, 0.5, -75) frame.BackgroundColor3 = Color3.fromRGB(30, 30, 30) frame.BackgroundTransparency = 0.1 frame.BorderSizePixel = 0 frame.AnchorPoint = Vector2.new(0.5, 0.5) frame.Active = true frame.Draggable = true frame.Parent = gui local toggleButton = Instance.new("TextButton") toggleButton.Size = UDim2.fromOffset(140, 40) toggleButton.Position = UDim2.fromOffset(10, 10) toggleButton.BackgroundColor3 = Color3.fromRGB(40, 90, 180) toggleButton.TextColor3 = Color3.new(1, 1, 1) toggleButton.Font = Enum.Font.SourceSansBold toggleButton.TextSize = 20 toggleButton.Text = "Set Toggle Key" toggleButton.Parent = frame local toggleLabel = Instance.new("TextLabel") toggleLabel.Size = UDim2.fromOffset(120, 40) toggleLabel.Position = UDim2.fromOffset(160, 10) toggleLabel.BackgroundColor3 = Color3.fromRGB(20, 20, 20) toggleLabel.TextColor3 = Color3.new(1, 1, 1) toggleLabel.Font = Enum.Font.SourceSans toggleLabel.TextSize = 20 toggleLabel.Text = toggleKey.Name toggleLabel.BorderSizePixel = 0 toggleLabel.Parent = frame local speedLabel = Instance.new("TextLabel") speedLabel.Size = UDim2.fromOffset(140, 20) speedLabel.Position = UDim2.fromOffset(10, 60) speedLabel.BackgroundTransparency = 1 speedLabel.TextColor3 = Color3.new(1, 1, 1) speedLabel.Font = Enum.Font.SourceSansBold speedLabel.TextSize = 18 speedLabel.Text = "WalkSpeed:" speedLabel.Parent = frame local speedBox = Instance.new("TextBox") speedBox.Size = UDim2.fromOffset(120, 40) speedBox.Position = UDim2.fromOffset(160, 60) speedBox.BackgroundColor3 = Color3.fromRGB(20, 20, 20) speedBox.TextColor3 = Color3.new(1, 1, 1) speedBox.Font = Enum.Font.SourceSans speedBox.TextSize = 20 speedBox.ClearTextOnFocus = false speedBox.Text = tostring(desiredWalkSpeed) speedBox.BorderSizePixel = 0 speedBox.Parent = frame local statusLabel = Instance.new("TextLabel") statusLabel.Size = UDim2.fromOffset(280, 20) statusLabel.Position = UDim2.fromOffset(10, 110) statusLabel.BackgroundTransparency = 1 statusLabel.TextColor3 = Color3.fromRGB(170, 170, 170) statusLabel.Font = Enum.Font.SourceSans statusLabel.TextSize = 18 statusLabel.Text = "LOCKED" statusLabel.Parent = frame -- === GUI Logic === toggleButton.MouseButton1Click:Connect(function() toggleLabel.Text = "Press any key..." waitingForKeyInput = true end) local function setLockedText() statusLabel.Text = walkSpeedLocked and ("LOCKED @ " .. desiredWalkSpeed) or "UNLOCKED" end local function applyDesiredSpeed() if walkSpeedLocked then humanoid.WalkSpeed = desiredWalkSpeed end setLockedText() end -- Validate & set the speed when the user finishes typing (Enter or clicking away) speedBox.FocusLost:Connect(function(enterPressed) local n = tonumber(speedBox.Text) if n and n > 0 then desiredWalkSpeed = n applyDesiredSpeed() else -- Revert to the last valid speed speedBox.Text = tostring(desiredWalkSpeed) end end) -- === Keep speed locked === RunService.RenderStepped:Connect(function() if walkSpeedLocked and humanoid.WalkSpeed ~= desiredWalkSpeed then humanoid.WalkSpeed = desiredWalkSpeed end end) -- === Character respawn === Players.LocalPlayer.CharacterAdded:Connect(function(char) character = char humanoid = character:WaitForChild("Humanoid") defaultWalkSpeed = humanoid.WalkSpeed applyDesiredSpeed() end) -- === Input handling === UserInputService.InputBegan:Connect(function(input, gameProcessed) if gameProcessed then return end -- Setting the toggle key if waitingForKeyInput and input.UserInputType == Enum.UserInputType.Keyboard then toggleKey = input.KeyCode toggleLabel.Text = toggleKey.Name waitingForKeyInput = false return end -- Toggling lock/unlock if input.KeyCode == toggleKey then walkSpeedLocked = not walkSpeedLocked if walkSpeedLocked then humanoid.WalkSpeed = desiredWalkSpeed else humanoid.WalkSpeed = defaultWalkSpeed end setLockedText() end end) -- Initialize text setLockedText()