Player disconnecting during remote call to RemoteFunction

Hi.
Is there any way of getting around the client disconnecting or leaving while it is being invoked from the server, causing it to error? Like, it should return something when it sees that the player has left.

Some sources say to use pcalls but… I don’t know what those are :frowning:

3 Likes

You would have to wrap it in a pcall so you would do something like this:

local Success, Err = pcall(function()
   -- Remote Event Here
end)

if Err then warn(Err) end -- If there is an Error then tell us what the error is

A pcall just make it so if there is an error it will display the error but the script won’t break.

10 Likes