

Description
Camera-relative tween movement built for Illegal Soccer by the BobloScript Team. Instead of pushing your character through Roblox's normal physics, the script tweens the HumanoidRootPart in short steps in whichever direction your camera is facing. That makes movement frame-independent and lets you set an exact speed instead of relying on WalkSpeed.
How it works
W, A, S and D are read as camera-relative directions, so forward always means the way your camera is looking — not the way the character happens to face.
Every step moves the root 5 studs and tweens for a duration calculated from the current speed value, so the same slider produces consistent motion whether you set it to 1 or 200.
The UI is a draggable dark panel with a green/red ON-OFF toggle, a slider from 1 to 200, and a keybind editor for all six actions.
A cursor locker is included so you can keep the mouse centered while steering. By default it binds to RightCtrl, and the toggle to RightShift — both can be rebound in the panel.
Key states reset on respawn, so you never spawn in with a key stuck down after a death.
Notes
It is a LocalScript and only changes your own character, so it does not affect other players on the server.
Because movement is tweened, the script is not affected by game-side WalkSpeed changes or slowdowns.
Functions
- Tween Movement
Developer tested with
Windows
Potassium
Screenshots
1 imageScript Code
1--// Camera-Relative W/A/S/D Tween Movement2--// Draggable Speed GUI + Toggle + Keybinds + Cursor Locker3--// LocalScript45local Players = game:GetService("Players")6local UserInputService = game:GetService("UserInputService")7local TweenService = game:GetService("TweenService")8local RunService = game:GetService("RunService")910local Player = Players.LocalPlayer1112--==================================================13-- CONFIG14--==================================================1516local MIN_SPEED = 117local MAX_SPEED = 20018local DEFAULT_SPEED = 5019local STEP_DISTANCE = 52021local Speed = DEFAULT_SPEED22local Running = false23local Enabled = true24local CursorLocked = false2526--==================================================27-- KEYBINDS28--==================================================2930local Keybinds = {31 Forward = Enum.KeyCode.W,32 Backward = Enum.KeyCode.S,33 Left = Enum.KeyCode.A,34 Right = Enum.KeyCode.D,35 Toggle = Enum.KeyCode.RightShift,36 ToggleCursor = Enum.KeyCode.RightControl,37}3839local BindNames = {40 Forward = "Forward (W)",41 Backward = "Backward (S)",42 Left = "Left (A)",43 Right = "Right (D)",44 Toggle = "Toggle Script",45 ToggleCursor = "Cursor Lock",46}4748--==================================================49-- KEY STATE50--==================================================5152local Keys = {53 [Keybinds.Forward] = false,54 [Keybinds.Backward] = false,55 [Keybinds.Left] = false,56 [Keybinds.Right] = false,57}5859local function RebuildKeys()60 Keys = {61 [Keybinds.Forward] = false,62 [Keybinds.Backward] = false,63 [Keybinds.Left] = false,64 [Keybinds.Right] = false,65 }66end6768--==================================================69-- CHARACTER70--==================================================7172local function GetRoot()73 local Character = Player.Character74 if not Character then return nil end75 return Character:FindFirstChild("HumanoidRootPart")76end7778--==================================================79-- CAMERA-RELATIVE DIRECTION80--==================================================8182local function GetCameraDirection()83 local Camera = workspace.CurrentCamera84 if not Camera then return Vector3.zero end8586 local Look = Camera.CFrame.LookVector87 local Right = Camera.CFrame.RightVector8889 local Forward = Vector3.new(Look.X, 0, Look.Z)90 local CameraRight = Vector3.new(Right.X, 0, Right.Z)9192 if Forward.Magnitude > 0 then Forward = Forward.Unit end93 if CameraRight.Magnitude > 0 then CameraRight = CameraRight.Unit end9495 local Direction = Vector3.zero9697 if Keys[Keybinds.Forward] then Direction += Forward end98 if Keys[Keybinds.Backward] then Direction -= Forward end99 if Keys[Keybinds.Right] then Direction += CameraRight end100 if Keys[Keybinds.Left] then Direction -= CameraRight end101102 if Direction.Magnitude == 0 then return Vector3.zero end103 return Direction.Unit104end105106--==================================================107-- MOVEMENT LOOP108--==================================================109110local function AnyMovementKeyDown()111 for _, v in pairs(Keys) do112 if v then return true end113 end114 return false115end116117local function MovementLoop()118 if Running then return end119 Running = true120121 while Enabled and AnyMovementKeyDown() do122 local Root = GetRoot()123 if not Root then124 task.wait()125 continue126 end127128 local Direction = GetCameraDirection()129130 if Direction.Magnitude > 0 then131 local TargetPosition = Root.Position + Direction * STEP_DISTANCE132 local TargetCFrame = CFrame.new(TargetPosition) * Root.CFrame.Rotation133 local Duration = STEP_DISTANCE / math.max(Speed, 1)134135 local Tween = TweenService:Create(136 Root,137 TweenInfo.new(Duration, Enum.EasingStyle.Linear, Enum.EasingDirection.Out),138 { CFrame = TargetCFrame }139 )140141 Tween:Play()142 Tween.Completed:Wait()143 else144 task.wait()145 end146 end147148 Running = false149end150151--==================================================152-- CURSOR LOCKER153--==================================================154155local function SetCursorLock(state)156 CursorLocked = state157158 if CursorLocked then159 UserInputService.MouseBehavior = Enum.MouseBehavior.LockCenter160 UserInputService.MouseIconEnabled = false161 else162 UserInputService.MouseBehavior = Enum.MouseBehavior.Default163 UserInputService.MouseIconEnabled = true164 end165end166167RunService.RenderStepped:Connect(function()168 if CursorLocked then169 UserInputService.MouseBehavior = Enum.MouseBehavior.LockCenter170 UserInputService.MouseIconEnabled = false171 end172end)173174--==================================================175-- GUI176--==================================================177178local GUI = Instance.new("ScreenGui")179GUI.Name = "TweenSpeedGUI"180GUI.ResetOnSpawn = false181GUI.Parent = Player:WaitForChild("PlayerGui")182183local Frame = Instance.new("Frame")184Frame.Name = "Main"185Frame.Size = UDim2.fromOffset(340, 385)186Frame.Position = UDim2.new(0.5, -170, 0.5, -192)187Frame.BackgroundColor3 = Color3.fromRGB(24, 24, 24)188Frame.BorderSizePixel = 0189Frame.Active = true190Frame.Parent = GUI191192local Corner = Instance.new("UICorner")193Corner.CornerRadius = UDim.new(0, 12)194Corner.Parent = Frame195196--==================================================197-- TITLE / DRAG198--==================================================199200local Title = Instance.new("TextLabel")201Title.Size = UDim2.new(1, -20, 0, 35)202Title.Position = UDim2.fromOffset(10, 5)203Title.BackgroundTransparency = 1204Title.Text = "Camera Tween Movement"205Title.TextColor3 = Color3.fromRGB(255, 255, 255)206Title.TextSize = 20207Title.Font = Enum.Font.GothamBold208Title.Parent = Frame209210local Dragging = false211local DragStart212local StartPosition213214Title.InputBegan:Connect(function(Input)215 if Input.UserInputType == Enum.UserInputType.MouseButton1 then216 Dragging = true217 DragStart = Input.Position218 StartPosition = Frame.Position219 end220end)221222UserInputService.InputChanged:Connect(function(Input)223 if Dragging and Input.UserInputType == Enum.UserInputType.MouseMovement then224 local Delta = Input.Position - DragStart225 Frame.Position = UDim2.new(226 StartPosition.X.Scale,227 StartPosition.X.Offset + Delta.X,228 StartPosition.Y.Scale,229 StartPosition.Y.Offset + Delta.Y230 )231 end232end)233234UserInputService.InputEnded:Connect(function(Input)235 if Input.UserInputType == Enum.UserInputType.MouseButton1 then236 Dragging = false237 end238end)239240--==================================================241-- TOGGLE BUTTON242--==================================================243244local ToggleButton = Instance.new("TextButton")245ToggleButton.Size = UDim2.new(1, -30, 0, 28)246ToggleButton.Position = UDim2.fromOffset(15, 42)247ToggleButton.BackgroundColor3 = Color3.fromRGB(60, 170, 80)248ToggleButton.BorderSizePixel = 0249ToggleButton.Text = "🟢 SCRIPT: ON"250ToggleButton.TextColor3 = Color3.fromRGB(255, 255, 255)251ToggleButton.TextSize = 15252ToggleButton.Font = Enum.Font.GothamBold253ToggleButton.AutoButtonColor = false254ToggleButton.Parent = Frame255256local ToggleCorner = Instance.new("UICorner")257ToggleCorner.CornerRadius = UDim.new(0, 8)258ToggleCorner.Parent = ToggleButton259260local function UpdateToggleVisual()261 ToggleButton.Text = Enabled and "🟢 SCRIPT: ON" or "🔴 SCRIPT: OFF"262 ToggleButton.BackgroundColor3 = Enabled263 and Color3.fromRGB(60, 170, 80)264 or Color3.fromRGB(170, 60, 60)265end266267ToggleButton.MouseButton1Click:Connect(function()268 Enabled = not Enabled269 if not Enabled then270 for k in pairs(Keys) do Keys[k] = false end271 Running = false272 end273 UpdateToggleVisual()274end)275276--==================================================277-- CURSOR LOCK / UNLOCK BUTTON (ЯРКАЯ КНОПКА)278--==================================================279280local CursorButton = Instance.new("TextButton")281CursorButton.Size = UDim2.new(1, -30, 0, 40)282CursorButton.Position = UDim2.fromOffset(15, 76)283CursorButton.BackgroundColor3 = Color3.fromRGB(200, 140, 40)284CursorButton.BorderSizePixel = 0285CursorButton.Text = "🔓 UNLOCK CURSOR (RightCtrl)"286CursorButton.TextColor3 = Color3.fromRGB(255, 255, 255)287CursorButton.TextSize = 14288CursorButton.Font = Enum.Font.GothamBold289CursorButton.AutoButtonColor = false290CursorButton.Parent = Frame291292local CursorCorner = Instance.new("UICorner")293CursorCorner.CornerRadius = UDim.new(0, 8)294CursorCorner.Parent = CursorButton295296-- Обводка, чтобы кнопка выделялась297local CursorStroke = Instance.new("UIStroke")298CursorStroke.Color = Color3.fromRGB(255, 200, 80)299CursorStroke.Thickness = 2300CursorStroke.Parent = CursorButton301302local function UpdateCursorVisual()303 if CursorLocked then304 CursorButton.Text = "🔒 LOCKED → нажми, чтобы UNLOCK (RightCtrl)"305 CursorButton.BackgroundColor3 = Color3.fromRGB(60, 170, 80)306 CursorStroke.Color = Color3.fromRGB(120, 255, 140)307 else308 CursorButton.Text = "🔓 UNLOCKED → нажми, чтобы LOCK (RightCtrl)"309 CursorButton.BackgroundColor3 = Color3.fromRGB(200, 140, 40)310 CursorStroke.Color = Color3.fromRGB(255, 200, 80)311 end312end313314CursorButton.MouseButton1Click:Connect(function()315 SetCursorLock(not CursorLocked)316 UpdateCursorVisual()317end)318319--==================================================320-- SPEED LABEL + SLIDER321--==================================================322323local SpeedLabel = Instance.new("TextLabel")324SpeedLabel.Size = UDim2.new(1, -30, 0, 25)325SpeedLabel.Position = UDim2.fromOffset(15, 124)326SpeedLabel.BackgroundTransparency = 1327SpeedLabel.Text = "Speed: " .. Speed328SpeedLabel.TextColor3 = Color3.fromRGB(220, 220, 220)329SpeedLabel.TextSize = 15330SpeedLabel.Font = Enum.Font.Gotham331SpeedLabel.TextXAlignment = Enum.TextXAlignment.Left332SpeedLabel.Parent = Frame333334local Slider = Instance.new("Frame")335Slider.Size = UDim2.new(1, -30, 0, 8)336Slider.Position = UDim2.fromOffset(15, 158)337Slider.BackgroundColor3 = Color3.fromRGB(55, 55, 55)338Slider.BorderSizePixel = 0339Slider.Active = true340Slider.Parent = Frame341342local SliderCorner = Instance.new("UICorner")343SliderCorner.CornerRadius = UDim.new(1, 0)344SliderCorner.Parent = Slider345346local Fill = Instance.new("Frame")347Fill.Size = UDim2.fromScale((Speed - MIN_SPEED) / (MAX_SPEED - MIN_SPEED), 1)348Fill.BackgroundColor3 = Color3.fromRGB(80, 170, 255)349Fill.BorderSizePixel = 0350Fill.Parent = Slider351352local FillCorner = Instance.new("UICorner")353FillCorner.CornerRadius = UDim.new(1, 0)354FillCorner.Parent = Fill355356local Knob = Instance.new("TextButton")357Knob.Size = UDim2.fromOffset(18, 18)358Knob.AnchorPoint = Vector2.new(0.5, 0.5)359Knob.Position = UDim2.new((Speed - MIN_SPEED) / (MAX_SPEED - MIN_SPEED), 0, 0.5, 0)360Knob.BackgroundColor3 = Color3.fromRGB(255, 255, 255)361Knob.BorderSizePixel = 0362Knob.Text = ""363Knob.AutoButtonColor = false364Knob.Parent = Slider365366local KnobCorner = Instance.new("UICorner")367KnobCorner.CornerRadius = UDim.new(1, 0)368KnobCorner.Parent = Knob369370local SliderDragging = false371372local function SetSlider(X)373 local Percent = math.clamp(374 (X - Slider.AbsolutePosition.X) / Slider.AbsoluteSize.X,375 0, 1376 )377 Speed = math.floor(MIN_SPEED + ((MAX_SPEED - MIN_SPEED) * Percent) + 0.5)378 local Normalized = (Speed - MIN_SPEED) / (MAX_SPEED - MIN_SPEED)379 Fill.Size = UDim2.fromScale(Normalized, 1)380 Knob.Position = UDim2.new(Normalized, 0, 0.5, 0)381 SpeedLabel.Text = "Speed: " .. Speed382end383384Slider.InputBegan:Connect(function(Input)385 if Input.UserInputType == Enum.UserInputType.MouseButton1 then386 SliderDragging = true387 SetSlider(Input.Position.X)388 end389end)390391Knob.InputBegan:Connect(function(Input)392 if Input.UserInputType == Enum.UserInputType.MouseButton1 then393 SliderDragging = true394 end395end)396397UserInputService.InputChanged:Connect(function(Input)398 if SliderDragging and Input.UserInputType == Enum.UserInputType.MouseMovement then399 SetSlider(Input.Position.X)400 end401end)402403UserInputService.InputEnded:Connect(function(Input)404 if Input.UserInputType == Enum.UserInputType.MouseButton1 then405 SliderDragging = false406 end407end)408409--==================================================410-- KEYBIND SECTION411--==================================================412413local KeybindTitle = Instance.new("TextLabel")414KeybindTitle.Size = UDim2.new(1, -30, 0, 22)415KeybindTitle.Position = UDim2.fromOffset(15, 180)416KeybindTitle.BackgroundTransparency = 1417KeybindTitle.Text = "Keybinds (нажми на поле и зажми клавишу)"418KeybindTitle.TextColor3 = Color3.fromRGB(180, 180, 180)419KeybindTitle.TextSize = 12420KeybindTitle.Font = Enum.Font.Gotham421KeybindTitle.TextXAlignment = Enum.TextXAlignment.Left422KeybindTitle.Parent = Frame423424local KeyScroll = Instance.new("ScrollingFrame")425KeyScroll.Size = UDim2.new(1, -30, 0, 170)426KeyScroll.Position = UDim2.fromOffset(15, 204)427KeyScroll.BackgroundColor3 = Color3.fromRGB(18, 18, 18)428KeyScroll.BorderSizePixel = 0429KeyScroll.CanvasSize = UDim2.new(0, 0, 0, 0)430KeyScroll.AutomaticCanvasSize = Enum.AutomaticSize.Y431KeyScroll.ScrollBarThickness = 4432KeyScroll.Parent = Frame433434local KeyScrollCorner = Instance.new("UICorner")435KeyScrollCorner.CornerRadius = UDim.new(0, 8)436KeyScrollCorner.Parent = KeyScroll437438local KeyLayout = Instance.new("UIListLayout")439KeyLayout.Padding = UDim.new(0, 4)440KeyLayout.SortOrder = Enum.SortOrder.LayoutOrder441KeyLayout.Parent = KeyScroll442443local KeyPadding = Instance.new("UIPadding")444KeyPadding.PaddingTop = UDim.new(0, 4)445KeyPadding.PaddingBottom = UDim.new(0, 4)446KeyPadding.PaddingLeft = UDim.new(0, 4)447KeyPadding.PaddingRight = UDim.new(0, 4)448KeyPadding.Parent = KeyScroll449450local AwaitingBind = nil451452local function KeyToString(key)453 if typeof(key) == "EnumItem" then454 return key.Name455 end456 return tostring(key)457end458459local function MakeBindRow(order, keyName)460 local Row = Instance.new("Frame")461 Row.Size = UDim2.new(1, 0, 0, 26)462 Row.BackgroundTransparency = 1463 Row.LayoutOrder = order464 Row.Parent = KeyScroll465466 local Label = Instance.new("TextLabel")467 Label.Size = UDim2.new(0.55, 0, 1, 0)468 Label.Position = UDim2.fromOffset(4, 0)469 Label.BackgroundTransparency = 1470 Label.Text = BindNames[keyName] or keyName471 Label.TextColor3 = Color3.fromRGB(220, 220, 220)472 Label.TextSize = 13473 Label.Font = Enum.Font.Gotham474 Label.TextXAlignment = Enum.TextXAlignment.Left475 Label.Parent = Row476477 local BindBtn = Instance.new("TextButton")478 BindBtn.Size = UDim2.new(0.4, -8, 1, -4)479 BindBtn.Position = UDim2.new(0.6, 0, 0, 2)480 BindBtn.BackgroundColor3 = Color3.fromRGB(45, 45, 45)481 BindBtn.BorderSizePixel = 0482 BindBtn.Text = KeyToString(Keybinds[keyName])483 BindBtn.TextColor3 = Color3.fromRGB(255, 255, 255)484 BindBtn.TextSize = 12485 BindBtn.Font = Enum.Font.GothamBold486 BindBtn.AutoButtonColor = false487 BindBtn.Parent = Row488489 local BtnCorner = Instance.new("UICorner")490 BtnCorner.CornerRadius = UDim.new(0, 6)491 BtnCorner.Parent = BindBtn492493 BindBtn.MouseButton1Click:Connect(function()494 if AwaitingBind and AwaitingBind ~= BindBtn then495 AwaitingBind.Text = KeyToString(Keybinds[AwaitingBind:GetAttribute("KeyName")])496 AwaitingBind.BackgroundColor3 = Color3.fromRGB(45, 45, 45)497 end498 AwaitingBind = BindBtn499 BindBtn.Text = "..."500 BindBtn.BackgroundColor3 = Color3.fromRGB(80, 120, 200)501 end)502503 BindBtn:SetAttribute("KeyName", keyName)504end505506for i, keyName in ipairs({"Forward", "Backward", "Left", "Right", "Toggle", "ToggleCursor"}) do507 MakeBindRow(i, keyName)508end509510UserInputService.InputBegan:Connect(function(Input, Processed)511 if not AwaitingBind then return end512 if Input.UserInputType ~= Enum.UserInputType.Keyboard then return end513514 local keyName = AwaitingBind:GetAttribute("KeyName")515 Keybinds[keyName] = Input.KeyCode516 AwaitingBind.Text = Input.KeyCode.Name517 AwaitingBind.BackgroundColor3 = Color3.fromRGB(45, 45, 45)518 AwaitingBind = nil519520 RebuildKeys()521522 -- Обновим подписи основных кнопок523 CursorButton.Text = CursorLocked524 and ("🔒 LOCKED → UNLOCK (" .. Keybinds.ToggleCursor.Name .. ")")525 or ("🔓 UNLOCKED → LOCK (" .. Keybinds.ToggleCursor.Name .. ")")526end)527528--==================================================529-- INPUT (горячие клавиши)530--==================================================531532UserInputService.InputBegan:Connect(function(Input, Processed)533 if Input.KeyCode == Keybinds.Toggle then534 Enabled = not Enabled535 if not Enabled then536 for k in pairs(Keys) do Keys[k] = false end537 Running = false538 end539 UpdateToggleVisual()540 return541 end542543 if Input.KeyCode == Keybinds.ToggleCursor then544 SetCursorLock(not CursorLocked)545 UpdateCursorVisual()546 return547 end548549 if Processed then return end550 if not Enabled then return end551552 if Keys[Input.KeyCode] ~= nil then553 Keys[Input.KeyCode] = true554 task.spawn(MovementLoop)555 end556end)557558UserInputService.InputEnded:Connect(function(Input)559 if Keys[Input.KeyCode] ~= nil then560 Keys[Input.KeyCode] = false561 end562end)563564--==================================================565-- INIT VISUALS566--==================================================567568UpdateToggleVisual()569UpdateCursorVisual()570571--==================================================572-- RESPAWN SAFETY573--==================================================574575Player.CharacterAdded:Connect(function()576 for Key in pairs(Keys) do577 Keys[Key] = false578 end579 Running = false580end)Illegal Soccer
View place →by Repotted · 1 script · 109 views





Comments
Loading comments…