RunService:UnbindFromRenderStep removed different functions with same reference name Camera 2 times

I have this camera control module that I use to call functions when they are needed for certain things. CameraControl.Start() is called when the player starts and after each camera function ends (it’s the default camera settings)

When a player enters a room I unbind the camera from render step, so the enter door camera animation can play without being impeeded, however, when I continously call this function, I get this warning
RunService:UnbindFromRenderStep removed different functions with same reference name Camera 2 times. (x2)

function CameraControl.EnterRoom(door)
	-- Unbind camera
	RunService:UnbindFromRenderStep("Camera")
	-- Other stuff
end

function CameraControl.Start(tween)
	local HumanoidRootPart = Character:FindFirstChild("HumanoidRootPart")
	if not HumanoidRootPart then return end
	
	local PlayerPosition = HumanoidRootPart.Position
	local CameraPosition = PlayerPosition + Offset
	
	if tween then
		-- Tween camera back to position
		local TweenCamera = TweenService:Create(Camera, TweenInfo.new(0.5), {CFrame = CFrame.new(CameraPosition, PlayerPosition)})
		TweenCamera:Play()
		TweenCamera.Completed:Wait()
	end
	
	-- Update camera movement
	local function UpdateCamera()
		PlayerPosition = HumanoidRootPart.Position
		CameraPosition = PlayerPosition + Offset
		
		Camera.CFrame = CFrame.new(CameraPosition, PlayerPosition)
	end

	-- Bind camera
	RunService:BindToRenderStep("Camera", Enum.RenderPriority.Camera.Value, UpdateCamera)
end
2 Likes

It is warning you that you are unbinding “Camera” from RunService more than once.

2 Likes

Am I not allowed to do that???

It is basically the same thing as sending requests to a datastore. Sometimes the requests drop after so many requests are sent. I am pretty sure it doesn’t affect gameplay in any way though.

2 Likes

You should only send a few requests every couple of seconds to avoid player’s FPS to rise.

1 Like

How can I get around this then? As I want the camera to always maintain it’s set position, but still allow it to do other things, like an entering room transition (which could be called several times in a minute)

Well you could try using what DataStore2 uses to save data. Maybe make a variable and find how many requests have been sent, and if too many have been sent, put new requests in a table or array. Once the RunService can take more requests, get the items from that table/array and send in a new request based on the info of the item.

1 Like

I’m not trying to save data tho???

I was using that as an example.

1 Like

Handling the requests sent is probably your best bet unless someone else can figure out another way to handle them.

1 Like

Well I am currently having a same warning and I wonder if anyone has found a better explanation for it!

2 Likes

This seems to happen when there exists 2 (or more) binded functions with the same name, and they get disconnected.

This code reproduces the warning:

local RunService = game:GetService("RunService")
RunService:BindToRenderStep("BindName", 1, function() end)
RunService:BindToRenderStep("BindName", 1, function() end)

RunService:UnbindFromRenderStep("BindName")
11 Likes

solo me pasa el Roblox Player, sabes porqué?

Hi ew I didnt expected to see you lol. Where do I put them I dont understand.

This is 100% roblox’s fault and not your code, now I could be wrong and i know this post is quite old, but I had the same issue and disabled all my scripts and still got the error, I even created a new place, a fresh new place with nothing, no builds , no scripts, you get the gist of it, and i was still getting the error, this is a roblox Studio error and not a scripter (you) error

6 Likes

I can also confirm this, although the warning can be linked to a specific service (RunService perhaps?) and how you handle the code.

1 Like

Do you know how to fix it? I am getting the same error.

Yep, same here, I am also getting that error and I didn’t even use the Runservice:BindToRenderStep function.

2 Likes