getcallbackthread
Returns the thread that assigned a callback property.
Syntax
getcallbackthread(object: Instance, property: string) -> thread?
Parameters
| Parameter | Type | Description |
|---|---|---|
object | Instance | The Instance whose callback property to read. |
property | string | The callback property's name, such as "OnInvoke" or "OnClientInvoke". |
Returns
| Type | Description |
|---|---|
thread? | The thread that installed the callback, or nil when none is set. |
Description
Callback properties such as BindableFunction.OnInvoke hold one function each. This returns the thread whose code assigned it, which you can pass to getscriptfromthread or gettenv to see which script owns the callback. Read the function itself with getcallbackvalue.
Example
local bindable = Instance.new("BindableFunction")
bindable.OnInvoke = function() return true end
print(getcallbackthread(bindable, "OnInvoke") == coroutine.running())
Notes
- A callback installed from another Luau state, such as an Actor, returns
nil.
These are Game executor contracts. Check build requirements and session lifetimes before using them.
