Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Enabled = false
- local Camera = game.Workspace.CurrentCamera
- local Player = game:GetService("Players").LocalPlayer
- local Input = game:GetService("UserInputService")
- local Forward = false
- local Back = false
- local Left = false
- local Right = false
- local Up = false
- local Down = false
- local function SetPlayer()
- for i,v in pairs(Player.Character:GetChildren()) do
- pcall(function()
- v.Anchored = not v.Anchored
- end)
- end
- end
- Input.InputBegan:Connect(function(Key,IsChat)
- if IsChat then return end
- if Key.KeyCode == Enum.KeyCode.LeftAlt then
- Enabled = not Enabled
- SetPlayer()
- end
- if Key.KeyCode == Enum.KeyCode.W then
- Forward = true
- end
- if Key.KeyCode == Enum.KeyCode.S then
- Back = true
- end
- if Key.KeyCode == Enum.KeyCode.A then
- Left = true
- end
- if Key.KeyCode == Enum.KeyCode.D then
- Right = true
- end
- if Key.KeyCode == Enum.KeyCode.Space then
- Up = true
- end
- if Key.KeyCode == Enum.KeyCode.LeftControl then
- Down = true
- end
- end)
- Input.InputEnded:Connect(function(Key,IsChat)
- if IsChat then return end
- if Key.KeyCode == Enum.KeyCode.W then
- Forward = false
- end
- if Key.KeyCode == Enum.KeyCode.S then
- Back = false
- end
- if Key.KeyCode == Enum.KeyCode.A then
- Left = false
- end
- if Key.KeyCode == Enum.KeyCode.D then
- Right = false
- end
- if Key.KeyCode == Enum.KeyCode.Space then
- Up = false
- end
- if Key.KeyCode == Enum.KeyCode.LeftControl then
- Down = false
- end
- end)
- while game:GetService("RunService").RenderStepped:Wait() do
- if Enabled then
- pcall(function()
- if Forward then
- Player.Character:TranslateBy(Camera.CFrame.lookVector*2)
- end
- if Back then
- Player.Character:TranslateBy(-Camera.CFrame.lookVector*2)
- end
- if Left then
- Player.Character:TranslateBy(-Camera.CFrame:vectorToWorldSpace(Vector3.new(1,0,0))*2)
- end
- if Right then
- Player.Character:TranslateBy(Camera.CFrame:vectorToWorldSpace(Vector3.new(1,0,0))*2)
- end
- if Up then
- Player.Character:TranslateBy(Camera.CFrame:vectorToWorldSpace(Vector3.new(0,1,0))*2)
- end
- if Down then
- Player.Character:TranslateBy(-Camera.CFrame:vectorToWorldSpace(Vector3.new(0,1,0))*2)
- end
- end)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement