Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Player = game.Players.LocalPlayer
- local UIS = game:GetService("UserInputService")
- local RunService = game:GetService("RunService")
- local speed = 1 -- higher = faster, you can tweak this
- local enabled = false
- -- Toggle with C
- UIS.InputBegan:Connect(function(input, gameProcessed)
- if not gameProcessed and input.KeyCode == Enum.KeyCode.C then
- enabled = not enabled
- end
- end)
- RunService.RenderStepped:Connect(function()
- if not enabled then return end
- local char = Player.Character
- if not char then return end
- local root = char:FindFirstChild("HumanoidRootPart")
- local humanoid = char:FindFirstChild("Humanoid")
- if root and humanoid and humanoid.MoveDirection.Magnitude > 0 then
- local moveDirection = humanoid.MoveDirection.Unit
- root.CFrame = root.CFrame + (moveDirection * speed)
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement