This was working yesterday and since then its just stopped working, only changes I’ve added is terrain.
Broken code (a snippet from my star wars guns):
local PlayerModule = game.Players.LocalPlayer.PlayerScripts:WaitForChild("PlayerModule")
local cameras = require(PlayerModule):GetCameras()
function setCamera(max, actual, minimum, bool, x, y, z)
local cameras = require(PlayerModule):GetCameras() -- To check if this has changed
local CameraController = cameras.activeCameraController -- Is now apparently nil?
Player.CameraMaxZoomDistance = max
Player.CameraMinZoomDistance = actual
Player.CameraMinZoomDistance = minimum
CameraController:SetMouseLockOffset(Vector3.new(x, y, z))
CameraController:SetIsMouseLocked(bool)
end
local cameras = require(PlayerModule):GetCameras()
function setCamera(max, actual, minimum, bool, x, y, z)
local cameras = require(PlayerModule):GetCameras() -- To check if this has changed
local CameraController = cameras.activeCameraController -- Is now apparently nil?
Player.CameraMaxZoomDistance = max
Player.CameraMinZoomDistance = actual
Player.CameraMinZoomDistance = minimum
local lockOffsetVector = Vector3.new(x, y, z)
CameraController:SetMouseLockOffset(lockOffsetVector)
CameraController:SetIsMouseLocked(bool)
end
If that doesn’t work, make sure x, y, and z are not nil.