I am not entirely sure if this it a bug or not but I am experiencing a really weird problem.
I am trying to setup this camera module that is working perfectly fine on another baseplate but when I add it to a separate baseplate it is giving me the following.
--[[
:Enable() -- Enables the menu camera
:Disable() -- Disables the menu camera
--]]
print(workspace:FindFirstChild('Selection'))
print(workspace:FindFirstChild('Selection'):FindFirstChild('Interactables'))
print(workspace:FindFirstChild('Selection'):FindFirstChild('Interactables'):FindFirstChild('selectorCamera'))
local MenuCamera = {
Camera = workspace.CurrentCamera;
CF0 = workspace:FindFirstChild('Selection'):FindFirstChild('Interactables'):FindFirstChild('selectorCamera').CFrame; -- origin CFrame based on an invisible Part instance which is used to easily position the camera in Studio
-- These max values determine how much the camera will rotate based on the mouse's position
MaxXRotation = 10; -- Degrees, accounts for both negative and positive directions.
MaxYRotation = 10; -- Degrees, accounts for both negative and positive directions
}
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
function MenuCamera.Enable(self)
if self.Connection then
self.Connection:Disconnect() -- Disconnect from the Mouse.Move event, if exists
end
self.Camera.CameraType = Enum.CameraType.Scriptable -- Set the CameraType to scriptable
local function MouseMove()
local XFloat = -0.5 + Mouse.X / self.Camera.ViewportSize.X
local YFloat = -0.5 + Mouse.Y / self.Camera.ViewportSize.Y
local CF = self.CF0 * CFrame.fromOrientation(
math.rad(self.MaxYRotation * -YFloat)
, math.rad(self.MaxXRotation * -XFloat)
, 0
)
self.Camera.CFrame = CF
end
self.Connection = Mouse.Move:Connect(MouseMove)
MouseMove()
end
function MenuCamera.Disable(self)
if self.Connection then
self.Connection:Disconnect() -- Disconnect from the Mouse.Move event, if exists
end
self.Camera.CameraType = Enum.CameraType.Custom -- Set the CameraType back to default
end
return MenuCamera
--// SERVICES
--// ITEMS
--# OBJECTS
local cameraModule = require(script:FindFirstChild('Camera'))
--// SCRIPTS
--# INIT
local function init()
cameraModule:Enable()
end
wait(1)
init()
WHILE GAME IS SIMULATING:
Really hope someone can help me, or tell me if this is a roblox bug.