Im trying to make use of Remote functions, specifically Server to Client to Server, and I’m wanting to make it so that if it doesn’t get the callback within a set time frame it sends a different value
I’ve tried some hackier solutions like
local function pingClient()
local data
task.spawn(function()
data = remoteFunction:Invoke()
end)
task.wait(.3)
if not data then
return defaultData
end
end
But it didn’t work in the script. Anyone have a possible solution?
It’s highly recommended NOT to use Remote Functions Server → Client → Server as it can cause a lot of issues on the Server Side (Game Lag for everyone currently in the game, etc).
For this type of setup, I think you would be better using Remote Events and checking that the response from the client isn’t more than the given time. Using this method allows for less possible issues of Remote Functions and will not create lag on the server (The method is more or less asynchronous).