Main Menu Camera script not working with R6

hello, for some reason my main menu camera script only works with r15 and r6 is required for the game, how can i fix this?

local MenuCamera = {
	Camera = workspace.CurrentCamera;
	CF0 = workspace:WaitForChild("cameraSpot").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 = 5; -- Degrees, accounts for both negative and positive directions.
	MaxYRotation = 5; -- 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
1 Like

I don’t see anything in the code you shared that has anything to do with the player’s character. Are you getting any errors when using R6?

i’m not getting any errors in output, but when i change the avatar type it completely messes it all up.

im having the same issue with r6 and r15 idk how to fix it i even tried waiting until after the character loaded