Collapse Sidebar


Given a name of a function sent to RunService/BindToRenderStep|BindToRenderStep, this method will unbind the function from being called during RenderStepped. This is used to unbind bound functions once they are no longer needed, or when they no longer need to fire every step.

If there is no bound function by the given name, this method raises an error. You can prevent such an error from being raised by using pcall. For example, if you bind a function named drawImage using RunService/BindToRenderStep|BindToRenderStep, the following code would unbind the function, suppressing errors if there wasn’t already a function with the name drawImage bound.

local RunService = game:GetService("RunService")
local success, message = pcall(function() RunService:UnbindFromRenderStep("drawImage") end)
if success then
	print("Success: Function unbound!")
	print("An error occurred: "..message)


Name Type Default Description

The name of the function being unbound


Return Type Summary


Code Samples

Bind and Unbind a Function

This example uses the RunService to bind and unbind a function named printHello. First, we bind the function to the RenderStep so that fires every step. Then, after we wait 5 seconds (wait(5)), we unbind the function.

Please note that we take caution to surround the function unbind in a pcall to prevent the code from breaking due to an error being thrown if the function name passed does not match the name of an already bound function. While we know that the function used in this example is bound when we try to unbind it, doing this is good coding practice.

local RunService = game:GetService("RunService")

-- Step 1: Declare the function and a name
local name = "Print Hello"
function printHello()

-- Step 3: Bind the function
RunService:BindToRenderStep(name, Enum.RenderPriority.First.Value, printHello)

-- Step 3: Unbind the function
local success, message = pcall(function() RunService:UnbindFromRenderStep(name) end)
if success then
	print("Success: Function unbound!")
	print("An error occurred: " .. message)