local Players = game:GetService("Players") local RunService = game:GetService("RunService") local UserInputService = game:GetService("UserInputService") local player = Players.LocalPlayer local playerScripts = player:WaitForChild("PlayerScripts") local controls = require(playerScripts:WaitForChild("PlayerModule")):GetControls() local BIND_NAME = "CameraAlignedMobileMove" local DEADZONE = 0.05 local function unbind() RunService:UnbindFromRenderStep(BIND_NAME) end local function hookCharacter(char) unbind() if not UserInputService.TouchEnabled then return end local humanoid = char:WaitForChild("Humanoid") RunService:BindToRenderStep(BIND_NAME, Enum.RenderPriority.Input.Value + 1, function() if not humanoid.Parent then unbind() return end local camera = workspace.CurrentCamera if not camera then return end local move = controls:GetMoveVector() local mag = move.Magnitude if mag <= DEADZONE then return end local camLook = camera.CFrame.LookVector local camRight = camera.CFrame.RightVector local forward = Vector3.new(camLook.X, 0, camLook.Z) local right = Vector3.new(camRight.X, 0, camRight.Z) if forward.Magnitude > 0 then forward = forward.Unit end if right.Magnitude > 0 then right = right.Unit end local worldMove = (right * move.X - forward * move.Z) if worldMove.Magnitude > 0 then humanoid:Move(worldMove.Unit, false) end end) end player.CharacterAdded:Connect(hookCharacter) if player.Character then hookCharacter(player.Character) end