Help with runservice connection not working

So I made a connection for my rendering system so whenever a player wants to disconnect the render run service it does connection:Disconnect()

image
image

But I get this error so idk what the problem is. If anyone knows please let me know, thank you.

BindToRenderStep doesn’t return a Signal, Its a callback, If you look at what it returns, it doesn’t return anything:

BindToRenderStep(name: string, priority: number, function: any): ()

: () means it doesn’t return anything

With Normal Events, it returns a RBXScriptConnection
For Example, RenderStepped:Connect()

Connect( func: (deltaTime: number) -> ()): RBXScriptConnection

because it doesn’t return this Connection, You cant Disconnect it.

Edit: you would use UnbindFromRenderStep to Disconnect this Callback.

1 Like

Expanding on @DasKairo’s answer:

You should be using RunService.RenderStepped instead:

local conn = game:GetService("RunService").RenderStepped:Connect(foo)
conn:Disconnect()
1 Like