Impossible to leave the free camera after doing Shift + P

still no updates :frowning: you would think this would be fixed by now with how important shift p is

2 Likes

This is a really annoying bug, having to rejoin to see the chat & my backpack again is super repetitive. I really hope that this gets resolved soon because at times I accidentally go in to freecam.

In the meantime while we wait for a fix, here is the working freecam before it broke.

1 Like

This bug is indeed an issue for me too. Would appreciate if we would get a response from Roblox soon.

1 Like

I just found out the freecam works fine when Workspace.SignalBehavior is set to Deferred. This bug starts to occur when SignalBehavior is set to any other value.

1 Like

That’s indeed a solution!! But this bug is still there, thx anyway

1 Like

@Ryxku Please do not mark that as the solution, otherwise this thread will be closed.

Freecam Script Difference (Before/After): Freecam Difference - Diffchecker
I think this bug happens as freecam has been enabled twice at the same time.

2 Likes

Okay my bad, but the post shows sometimes a pop up saying
" Has your question been answered?

Highlight the answer and help others by using the solution button below the correct reply."
It’s confusing tbh.

3 Likes

+1 This is still re-occuring in our game as of today as well

3 Likes

Fixed it.

Cause: Whenever the ToggleFreecam function is called (line 451), it calls StartFreecam() or StopFreecam() depending on an enabled boolean.

local function ToggleFreecam()
		if enabled then
			StopFreecam()
		else
			StartFreecam()
		end
		enabled = not enabled
	end

In StartFreecam, there is an attribute set to true and for StopFreecam, the attribute is set to false.

local function StartFreecam() 
	if FFlagUserShowGuiHideToggles then 
		script:SetAttribute("FreecamEnabled", true)
	end
end

local function StopFreecam()
	if FFlagUserShowGuiHideToggles then
		script:SetAttribute("FreecamEnabled", false)
	end
	-- other code
end

This leads to the attribute’s :GetAttributeChangedSignal being called.

script:GetAttributeChangedSignal("FreecamEnabled"):Connect(function()
	local attributeValue = script:GetAttribute("FreecamEnabled") -- original code uses variable in place of FreecamEnabled
			
	-- If the attribute's value and `enabled` var don't match, pick attribute value as 
	-- source of truth
			
	if attributeValue ~= enabled then
		if attributeValue then
			StartFreecam()	
			enabled = true
		else
			StopFreecam()	
			enabled = false
		end
	end
end)

Remembet the ToggleFreecam code from earlier? Well the enabled boolean never changes its value because the other code is getting called first. In other words, ToggleFreecam is called, Starting/Stopping the freecam. The code then sets the attribute to true or false, firing :GetAttributeChangedSignal. All of this leads to this code

--      true          false
if attributeValue ~= enabled then

and because enabled hasn’t changed, the if statement runs, calling StartFreecam again.

TL;DR
enabled = not enabled isn’t ran until after a bunch of other code has ran, in which the other code starts the freecam a second time, causing the error

SOLUTION:
Given everything stated, the solution is quite easy, only adding two lines of code

local function ToggleFreecam() -- Updated code
	if enabled then
		enabled = false
		StopFreecam()
	else
		enabled = true
		StartFreecam()
	end
end

This works because instead of waiting until the other code has ran, THEN changing enabled, it is instantly changed, fixing all the errors.

EDIT:
If you want to implement the fixed code in your game, run a playtest and copy the Freecam ScreenGui and Paste it into StarterGui. Then, edit the current code to have the updated code. You can now remove the older Freecam until roblox officially fixes it. If you don’t know how to remove it, here is some code you can use

-- ServerScript in ServerScriptService
game:GetService("Players").PlayerAdded:Connect(function(player)
	
	player.PlayerGui:FindFirstChild("Freecam"):Destroy() -- Rename copied version to avoid deleting the wrong one

end)

Thanks for the reports! We’re looking into doing a temporary flag rollback on some platforms until we can deploy a fix.

As a workaround until then: instead of using the shortcut to toggle Freecam, you can do so by setting the FreecamEnabled attribute on the Freecam script:

We will follow up once a bugfix is live!

Edit: we have done a rollback, so this should be resolved :slight_smile:

8 Likes

I would like to mention @Shinrai12 has found an easier way to fix it for the moment!

1 Like

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