I’m trying to set the camera to a part and have it move a bit accordingly to the mouse’s position. However, when I join the game nothing happens at all and there isn’t a single error in the output. I added a print(“test”) in the function to see if it was even running and it wasn’t. I really don’t know why, any help is appreciated, thanks!
--//Services
local RunService = game:GetService("RunService")
local Players = game:GetService("Players")
--//Objects
local CameraPart = workspace.GameRoom:WaitForChild("CameraPart")
local CurrentCamera = workspace.CurrentCamera
local LocalPlayer = Players.LocalPlayer
local Mouse = LocalPlayer:GetMouse()
wait(0.001)
CurrentCamera.CameraType = Enum.CameraType.Scriptable
CurrentCamera.CameraSubject = CameraPart
--//Constants
local MOVE_SPEED = 150
--//Functions
local function UpdateCamera()
local Center = CameraPart.CFrame
local MoveVector = Vector3.new((Mouse.X - Center.X) / MOVE_SPEED, (Mouse.Y - Center.Y) / MOVE_SPEED, 0)
CurrentCamera.CFrame = CameraPart.CFrame * CFrame.Angles(math.rad(-(Mouse.Y - Center.Y) / MOVE_SPEED), math.rad(-(Mouse.X - Center.X) / MOVE_SPEED), 0)
end
--//Events
RunService.RenderStepped:Connect(UpdateCamera)