Hi everyone!
First of all, here are some videos to show what’s happening:
This is with the part controlling the camera not rotated at all. (Pressing W & S)
This is with the part controlling the camera rotated 90 degrees.
What I’m trying to accomplish:
The same thing as video 1 but in all rotations.
Here’s my code:
-- // Variables
local CurrentCamera = workspace.CurrentCamera
local Player = game.Players.LocalPlayer
local CameraPart = workspace.WorkspaceModules.Camera
local UserInputService = game:GetService("UserInputService")
local Mouse = Player:GetMouse()
while wait() do
if UserInputService:IsKeyDown(Enum.KeyCode.W) then
CameraPart.CFrame = CameraPart.CFrame * CFrame.new(0,0,-1)
end
if UserInputService:IsKeyDown(Enum.KeyCode.A) then
CameraPart.CFrame = CameraPart.CFrame * CFrame.new(-1,0,0)
end
if UserInputService:IsKeyDown(Enum.KeyCode.S) then
CameraPart.CFrame = CameraPart.CFrame * CFrame.new(0,0,1)
end
if UserInputService:IsKeyDown(Enum.KeyCode.D) then
CameraPart.CFrame = CameraPart.CFrame * CFrame.new(1,0,0)
end
end
Thanks for reading!