Setting player's camera to Orbital causes a runservice error in the CameraModule [RESOLVED]

The video to review the problem:

The main menu code:

local player = game:GetService("Players")
local lplr = player.LocalPlayer

local plrgui = lplr.PlayerGui
local menu = plrgui:WaitForChild("Menu")
local playbutton = menu.Play
local cheatsbutton = menu.EnableCheats
local gradient = cheatsbutton.spin
local activatedcheats = false
local spin = false

local hotbar = plrgui.CustomInventory.HotBar

hotbar.Position = UDim2.new(0,0,1.2,0)

local camera = workspace.CurrentCamera
local menucamera = workspace:WaitForChild("MenuCamera")

camera.CameraType = Enum.CameraType.Scriptable
camera.CFrame = menucamera.CFrame

local menumusic = Instance.new("Sound")
menumusic.Parent = workspace
menumusic.Volume = 1
menumusic.SoundId = "rbxassetid://9045766377"
menumusic:Play()

local sg = game:GetService("StarterGui")
sg:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false)
sg:SetCoreGuiEnabled(Enum.CoreGuiType.Health, false)

local ts = game:GetService("TweenService")
local ti = TweenInfo.new(5)
local ti2 = TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut)

playbutton.MouseButton1Click:Once(function()
	camera.CameraType = Enum.CameraType.Orbital
	menu.Enabled = false
	ts:Create(menumusic, ti, {Volume = 0}):Play()
	ts:Create(hotbar, ti2, {Position = UDim2.new(0, 0, 0.93, 0)}):Play()
	hotbar.Parent.HudScript.Enabled = true
	task.wait(5)
	menumusic:Destroy()
end)

cheatsbutton.MouseButton1Click:Connect(function()
	if activatedcheats == false then
		activatedcheats = true
		
		cheatsbutton.TextColor3 = Color3.fromRGB(255,255,255)
		gradient.Enabled = true
		spin = true
		
	elseif activatedcheats == true then
		activatedcheats = false
		
		cheatsbutton.TextColor3 = Color3.fromRGB(140,140,140)
		gradient.Enabled = false
		spin = false
		
	end
end)

local rs = game:GetService("RunService")

local function spingradient()
	rs.Heartbeat:Connect(function()
		if spin == true then
			gradient.Rotation += 1
		end
	end)
end
spingradient()

The console output:

I’m not sure if this is caused from a new random studio update that I got today or what the cause is.
Yesterday the orbital camera worked as intended, but now for some reason setting the camera to orbital fires a ton of errors for no reason.
I have tested this in an empty template and it seems to still cause the error, I’m sure that I’m not the only one!

If anyone could review this for themselves and to find the solution, it would be grateful.

This is also my first post on the devforum,.

2 Likes

They forgot to pass the variable to a function

Roblox forgot to pass deltatime to the getRotation function in the CameraModule after a short investigation.

You can fix this by adding the “dt” argument to the call at line 220 under CameraModule.OrbitalCamera showcased here

Really stupid mess up to be honest, how did this slip by Roblox??
I spent literally 2 minutes troubleshooting and immediately found the issue.

4 Likes

Holy moly, it worked like nothing has ever happened, thank you very much!

1 Like

I opened a bug report for this and it should be fixed eventually.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.