Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local c = workspace.CurrentCamera
- local player = game.Players.LocalPlayer
- local userInput = game:GetService("UserInputService")
- local rs = game:GetService("RunService")
- local starterPlayer = game:GetService("StarterPlayer")
- local selected = false
- local speed = 60
- local lastUpdate = 0
- function getNextMovement(deltaTime)
- local nextMove = Vector3.new()
- -- Left/Right
- if userInput:IsKeyDown("A") or userInput:IsKeyDown("Left") then
- nextMove = Vector3.new(-1,0,0)
- elseif userInput:IsKeyDown("D") or userInput:IsKeyDown("Right") then
- nextMove = Vector3.new(1,0,0)
- end
- -- Forward/Back
- if userInput:IsKeyDown("W") or userInput:IsKeyDown("Up") then
- nextMove = nextMove + Vector3.new(0,0,-1)
- elseif userInput:IsKeyDown("S") or userInput:IsKeyDown("Down") then
- nextMove = nextMove + Vector3.new(0,0,1)
- end
- -- Up/Down
- if userInput:IsKeyDown("Space") then
- nextMove = nextMove + Vector3.new(0,1,0)
- elseif userInput:IsKeyDown("LeftControl") then
- nextMove = nextMove + Vector3.new(0,-1,0)
- end
- return CFrame.new( nextMove * (speed * deltaTime) )
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement