I need someone to make a camera script or teach me how to make a camera script that can be maneuvered by pressing W, A, S, or D. (the normal keys to move a character and the studio's camera) It also has to be able to be rotated with Right-Click & Drag.
Attempted Code:
local cam = workspace.CurrentCamera
--cam.CameraSubject = workspace.FreeCamera
cam.CameraType = "Custom"
local userInputService = game:GetService("UserInputService")
local player = game.Players.LocalPlayer
local X = 0
local Y = 0
local Z = 0
--[[
Camera Controls:
W = Moves camera forward (+X)
A = Moves camera left (-Z?)
S = Moves camera backwards (-X)
D = Moves camera right (+Z?)
--]]
-- Handle inputBegan event (when player first presses a key)
userInputService.InputBegan:connect(function(inputObject)
if inputObject.KeyCode == Enum.KeyCode.W then --Move forward
X = X + 1
cam.CoordinateFrame = CFrame.new(X, Y, Z)
end
if inputObject.KeyCode == Enum.KeyCode.S then --Move backwards
X = X - 1
cam.CoordinateFrame = CFrame.new(X, Y, Z)
end
end)
-- Handle inputEnded event (when player releases a key)
userInputService.InputEnded:connect(function(inputObject)
if inputObject.KeyCode == Enum.KeyCode.W then --Reverses the X/Y/Z position because? I have no clue why! :D
X = X - 1
end
if inputObject.KeyCode == Enum.KeyCode.S then
X = X + 1
end
end)
I kinda gave up mid-way so, yeah there's a lot of errors in there.
If you can help me or know someone who can help me, please respond! I really need this. ~Chez_Guy :)

4 comments
Camera scripting should be done completely in Lua now as far as I'm aware, so I'd encourage you to check Roblox's code out.
@Avigant I dont know where the code for their camera system is
I believe L Shift + L will pull up freecam for the game dev only.
^ I remember there was a script for that somewhere in PlayerScripts I think. You could use that and edit the code to work for all players. Note that the script can be complex though.