L
Key RequiredUniversal

L

Universal ScriptvobBoxvobBox 6.1K views 5 executesUpdated May 4, 2025
5.0/ 5(1 votes)
10100% Positive
Lua Script•73 lines (2087 chars)
local UserInputService = game:GetService("UserInputService")
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")

local player = Players.LocalPlayer
local playerGui = player:WaitForChild("PlayerGui")

local autoWalk = false
local humanoid = nil

-- Create the UI only once
local screenGui = Instance.new("ScreenGui")
screenGui.Name = "AutoWalkGUI"
screenGui.ResetOnSpawn = false -- Prevent it from resetting on death
screenGui.Parent = playerGui

local toggleButton = Instance.new("TextButton")
toggleButton.Size = UDim2.new(0, 120, 0, 40)
toggleButton.Position = UDim2.new(0, 20, 0, 20)
toggleButton.Text = "Start Walking"
toggleButton.BackgroundColor3 = Color3.fromRGB(50, 150, 50)
toggleButton.TextColor3 = Color3.new(1, 1, 1)
toggleButton.Font = Enum.Font.SourceSansBold
toggleButton.TextSize = 22
toggleButton.Parent = screenGui

local function updateButtonUI()
	if autoWalk then
		toggleButton.Text = "Stop Walking"
		toggleButton.BackgroundColor3 = Color3.fromRGB(150, 50, 50)
	else
		toggleButton.Text = "Start Walking"
		toggleButton.BackgroundColor3 = Color3.fromRGB(50, 150, 50)
	end
end

local function toggleAutoWalk()
	autoWalk = not autoWalk
	updateButtonUI()
end

toggleButton.MouseButton1Click:Connect(toggleAutoWalk)

UserInputService.InputBegan:Connect(function(input, gameProcessed)
	if gameProcessed then return end
	if input.KeyCode == Enum.KeyCode.L then
		toggleAutoWalk()
	end
end)

-- Function to rebind humanoid when player respawns
local function bindCharacter()
	local character = player.Character or player.CharacterAdded:Wait()
	humanoid = character:WaitForChild("Humanoid")
end

-- Initial binding
bindCharacter()

-- Rebind on respawn
player.CharacterAdded:Connect(function()
	bindCharacter()
end)

-- Auto-walk logic
RunService.RenderStepped:Connect(function()
	if autoWalk and humanoid and humanoid.MoveDirection.Magnitude == 0 then
		local camera = workspace.CurrentCamera
		local forward = camera.CFrame.LookVector
		forward = Vector3.new(forward.X, 0, forward.Z).Unit
		humanoid:Move(forward, false)
	end
end)

Features & Information

L

Community Comments (1)

skyislandsskyislandsMay 4, 2025

what is this? also dont use chatgpt

More Scripts for Universal Scripts