Some Questions about Remotes and Bindables

Hey developers, does erroring in RemoteEvent or RemoteFunction handlers can stop the script handles the event? Let’s say there’s script A, it handles RemoteA and the script errors if the passed argument is incorrect. And Client A fires RemoteA and passed the wrong arguments. Will Script A stop running or just continue running?

Also if the event or function handlers yield, will the script proceed or yield.

I wonder this applies the same to Bindables too.

Any help will be appreciated. If you cannot understand what I am talking, I apologize in advance.

  • remoteEvents and bindables
    if q errors .Event, z will continue :Fire()

  • remoteFunctions and bindables Functions
    if q errors .onInvoke, z will error :Invoke()

not tested

  • remoteEvents and bindables
    if q yields.Event, z doesnt :Fire()

  • remoteFunctions and bindables Functions
    if q yields .onInvoke, z will :Invoke()

1 Like

Sorry, I dont understand what are you trying to tell, can you please elaborate further more?

Callback functions connected to RBXScriptSignal objects run in an isolated stack (when invoked by the firing of that RBXScriptSignal object) meaning that thrown/raised errors will never be propogated to the main thread of execution, you can explicitly test this by doing the following in a server script.

local Game = game
local Players = Game:GetService("Players")

local function OnPlayerAdded(Player)
	print("Hello world!")
	error() --Explicitly throw/raise an error inside the callback function connected to the player's 'PlayerAdded' event.
end

Players.PlayerAdded:Connect(OnPlayerAdded)

task.wait(5) --Wait some length of time.
print("Test.") --Unaffected by the error.

image

1 Like