Skip to content

Instantly share code, notes, and snippets.

@jLn0n
Created November 24, 2025 19:15
Show Gist options
  • Select an option

  • Save jLn0n/6325e0e07559b7f20312eb7afefef790 to your computer and use it in GitHub Desktop.

Select an option

Save jLn0n/6325e0e07559b7f20312eb7afefef790 to your computer and use it in GitHub Desktop.
workspace.SignalBehavior check
local function isDeferred(): boolean
local result = true
local eventus = Instance.new("BindableEvent")
eventus.Event:Once(function()
result = false
eventus:Destroy()
end)
eventus:Fire()
return result
end
local function isAncestryDeferred(): boolean
local result = false
local container = Instance.new("Folder")
local check = Instance.new("Folder", container)
container.DescendantRemoving:Once(function()
result = not check.Parent
end)
container:Destroy()
return result
end
local SIGNAL_BEHAVIOR = (function()
task.wait() -- waits for a frame so there would be no false-positives on Client
if isDeferred() then
return Enum.SignalBehavior.Deferred
elseif isAncestryDeferred() then
return Enum.SignalBehavior.AncestryDeferred
end
return Enum.SignalBehavior.Immediate
end)()
print(SIGNAL_BEHAVIOR)
@jLn0n
Copy link
Author

jLn0n commented Nov 24, 2025

how this works?

  • in Deferred, Signals are checked if it would fire immediately
  • in AncestryDeferred, the check's parent would be checked if Parent is not nil in DescendantRemoving since signals still does act Immediate
  • Immediate would be the default if previous checks failed

@jLn0n
Copy link
Author

jLn0n commented Nov 24, 2025

i know the Deferred check is known but i just want to share something to the community

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment