Speed Ui
Key Required

Speed Ui

[NEW ITEMS!] Illegal SoccerWI888WI888 3.9K views 16.5K executesUpdated Aug 30, 2026
Unrated
00
Lua Script•404 lines (8754 chars)
--// Camera-Relative W/A/S/D Tween Movement
--// Draggable Speed GUI
--// LocalScript

local Players = game:GetService("Players")
local UserInputService = game:GetService("UserInputService")
local TweenService = game:GetService("TweenService")

local Player = Players.LocalPlayer

--==================================================
-- CONFIG
--==================================================

local MIN_SPEED = 1
local MAX_SPEED = 200
local DEFAULT_SPEED = 50
local STEP_DISTANCE = 5

local Speed = DEFAULT_SPEED
local Running = false

--==================================================
-- KEY STATE
--==================================================

local Keys = {
	[Enum.KeyCode.W] = false,
	[Enum.KeyCode.A] = false,
	[Enum.KeyCode.S] = false,
	[Enum.KeyCode.D] = false,
}

--==================================================
-- CHARACTER
--==================================================

local function GetRoot()
	local Character = Player.Character

	if not Character then
		return nil
	end

	return Character:FindFirstChild("HumanoidRootPart")
end

--==================================================
-- CAMERA-RELATIVE DIRECTION
--==================================================

local function GetCameraDirection()
	local Camera = workspace.CurrentCamera

	if not Camera then
		return Vector3.zero
	end

	local Look = Camera.CFrame.LookVector
	local Right = Camera.CFrame.RightVector

	-- Keep movement horizontal
	local Forward = Vector3.new(
		Look.X,
		0,
		Look.Z
	)

	local CameraRight = Vector3.new(
		Right.X,
		0,
		Right.Z
	)

	if Forward.Magnitude > 0 then
		Forward = Forward.Unit
	end

	if CameraRight.Magnitude > 0 then
		CameraRight = CameraRight.Unit
	end

	local Direction = Vector3.zero

	if Keys[Enum.KeyCode.W] then
		Direction += Forward
	end

	if Keys[Enum.KeyCode.S] then
		Direction -= Forward
	end

	if Keys[Enum.KeyCode.D] then
		Direction += CameraRight
	end

	if Keys[Enum.KeyCode.A] then
		Direction -= CameraRight
	end

	if Direction.Magnitude == 0 then
		return Vector3.zero
	end

	return Direction.Unit
end

--==================================================
-- MOVEMENT LOOP
--==================================================

local function MovementLoop()
	if Running then
		return
	end

	Running = true

	while
		Keys[Enum.KeyCode.W]
		or Keys[Enum.KeyCode.A]
		or Keys[Enum.KeyCode.S]
		or Keys[Enum.KeyCode.D]
	do
		local Root = GetRoot()

		if not Root then
			task.wait()
			continue
		end

		local Direction = GetCameraDirection()

		if Direction.Magnitude > 0 then
			local TargetPosition =
				Root.Position + Direction * STEP_DISTANCE

			-- Preserve character rotation
			local TargetCFrame =
				CFrame.new(TargetPosition) *
				Root.CFrame.Rotation

			local Duration =
				STEP_DISTANCE / math.max(Speed, 1)

			local Tween = TweenService:Create(
				Root,
				TweenInfo.new(
					Duration,
					Enum.EasingStyle.Linear,
					Enum.EasingDirection.Out
				),
				{
					CFrame = TargetCFrame
				}
			)

			Tween:Play()
			Tween.Completed:Wait()
		else
			task.wait()
		end
	end

	Running = false
end

--==================================================
-- INPUT
--==================================================

UserInputService.InputBegan:Connect(function(Input, Processed)
	if Processed then
		return
	end

	if Keys[Input.KeyCode] ~= nil then
		Keys[Input.KeyCode] = true
		task.spawn(MovementLoop)
	end
end)

UserInputService.InputEnded:Connect(function(Input)
	if Keys[Input.KeyCode] ~= nil then
		Keys[Input.KeyCode] = false
	end
end)

--==================================================
-- GUI
--==================================================

local GUI = Instance.new("ScreenGui")
GUI.Name = "TweenSpeedGUI"
GUI.ResetOnSpawn = false
GUI.Parent = Player:WaitForChild("PlayerGui")

local Frame = Instance.new("Frame")
Frame.Name = "Main"
Frame.Size = UDim2.fromOffset(320, 135)
Frame.Position = UDim2.new(0.5, -160, 0.5, -67)
Frame.BackgroundColor3 = Color3.fromRGB(24, 24, 24)
Frame.BorderSizePixel = 0
Frame.Active = true
Frame.Parent = GUI

local Corner = Instance.new("UICorner")
Corner.CornerRadius = UDim.new(0, 12)
Corner.Parent = Frame

--==================================================
-- TITLE / DRAG AREA
--==================================================

local Title = Instance.new("TextLabel")
Title.Size = UDim2.new(1, -20, 0, 35)
Title.Position = UDim2.fromOffset(10, 5)
Title.BackgroundTransparency = 1
Title.Text = "Camera Tween Movement"
Title.TextColor3 = Color3.fromRGB(255, 255, 255)
Title.TextSize = 20
Title.Font = Enum.Font.GothamBold
Title.Parent = Frame

--==================================================
-- DRAGGING
--==================================================

local Dragging = false
local DragStart
local StartPosition

Title.InputBegan:Connect(function(Input)
	if Input.UserInputType == Enum.UserInputType.MouseButton1 then
		Dragging = true
		DragStart = Input.Position
		StartPosition = Frame.Position
	end
end)

UserInputService.InputChanged:Connect(function(Input)
	if
		Dragging
		and Input.UserInputType == Enum.UserInputType.MouseMovement
	then
		local Delta = Input.Position - DragStart

		Frame.Position = UDim2.new(
			StartPosition.X.Scale,
			StartPosition.X.Offset + Delta.X,
			StartPosition.Y.Scale,
			StartPosition.Y.Offset + Delta.Y
		)
	end
end)

UserInputService.InputEnded:Connect(function(Input)
	if Input.UserInputType == Enum.UserInputType.MouseButton1 then
		Dragging = false
	end
end)

--==================================================
-- SPEED LABEL
--==================================================

local SpeedLabel = Instance.new("TextLabel")
SpeedLabel.Size = UDim2.new(1, -30, 0, 25)
SpeedLabel.Position = UDim2.fromOffset(15, 40)
SpeedLabel.BackgroundTransparency = 1
SpeedLabel.Text = "Speed: " .. Speed
SpeedLabel.TextColor3 = Color3.fromRGB(220, 220, 220)
SpeedLabel.TextSize = 15
SpeedLabel.Font = Enum.Font.Gotham
SpeedLabel.TextXAlignment = Enum.TextXAlignment.Left
SpeedLabel.Parent = Frame

--==================================================
-- SLIDER
--==================================================

local Slider = Instance.new("Frame")
Slider.Name = "Slider"
Slider.Size = UDim2.new(1, -30, 0, 8)
Slider.Position = UDim2.fromOffset(15, 78)
Slider.BackgroundColor3 = Color3.fromRGB(55, 55, 55)
Slider.BorderSizePixel = 0
Slider.Active = true
Slider.Parent = Frame

local SliderCorner = Instance.new("UICorner")
SliderCorner.CornerRadius = UDim.new(1, 0)
SliderCorner.Parent = Slider

local Fill = Instance.new("Frame")
Fill.Size = UDim2.fromScale(
	(Speed - MIN_SPEED) / (MAX_SPEED - MIN_SPEED),
	1
)
Fill.BackgroundColor3 = Color3.fromRGB(80, 170, 255)
Fill.BorderSizePixel = 0
Fill.Parent = Slider

local FillCorner = Instance.new("UICorner")
FillCorner.CornerRadius = UDim.new(1, 0)
FillCorner.Parent = Fill

local Knob = Instance.new("TextButton")
Knob.Size = UDim2.fromOffset(18, 18)
Knob.AnchorPoint = Vector2.new(0.5, 0.5)
Knob.Position = UDim2.new(
	(Speed - MIN_SPEED) / (MAX_SPEED - MIN_SPEED),
	0,
	0.5,
	0
)
Knob.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
Knob.BorderSizePixel = 0
Knob.Text = ""
Knob.AutoButtonColor = false
Knob.Parent = Slider

local KnobCorner = Instance.new("UICorner")
KnobCorner.CornerRadius = UDim.new(1, 0)
KnobCorner.Parent = Knob

--==================================================
-- SLIDER CONTROL
--==================================================

local SliderDragging = false

local function SetSlider(X)
	local Percent = math.clamp(
		(X - Slider.AbsolutePosition.X)
		/ Slider.AbsoluteSize.X,
		0,
		1
	)

	Speed = math.floor(
		MIN_SPEED
		+ ((MAX_SPEED - MIN_SPEED) * Percent)
		+ 0.5
	)

	local Normalized =
		(Speed - MIN_SPEED)
		/ (MAX_SPEED - MIN_SPEED)

	Fill.Size = UDim2.fromScale(
		Normalized,
		1
	)

	Knob.Position = UDim2.new(
		Normalized,
		0,
		0.5,
		0
	)

	SpeedLabel.Text = "Speed: " .. Speed
end

Slider.InputBegan:Connect(function(Input)
	if Input.UserInputType == Enum.UserInputType.MouseButton1 then
		SliderDragging = true
		SetSlider(Input.Position.X)
	end
end)

Knob.InputBegan:Connect(function(Input)
	if Input.UserInputType == Enum.UserInputType.MouseButton1 then
		SliderDragging = true
	end
end)

UserInputService.InputChanged:Connect(function(Input)
	if
		SliderDragging
		and Input.UserInputType == Enum.UserInputType.MouseMovement
	then
		SetSlider(Input.Position.X)
	end
end)

UserInputService.InputEnded:Connect(function(Input)
	if Input.UserInputType == Enum.UserInputType.MouseButton1 then
		SliderDragging = false
	end
end)

--==================================================
-- RESPAWN SAFETY
--==================================================

Player.CharacterAdded:Connect(function()
	for Key in pairs(Keys) do
		Keys[Key] = false
	end

	Running = false
end)

Features & Information

vibe coded 100% but hey it works 🤫

Community Comments (1)

vw6222vw6222Sep 16, 2026

ai and doesnt work LOL

More Scripts for [NEW ITEMS!] Illegal Soccer