Hello. I have a particular call stack that only works 60-80% of the time and I can’t figure out the issue. Also, the randomness makes it very difficult to test. I thought that maybe the server side of the service wasn’t being initialized before the client, but I already eliminated that possibility.
Basically, I call a function called ObjectService.CreateNew()
and it has a code block I used frequently which basically says
if isServer then
-- do something
else
return ObjectEvents.ExecuteOnServer:InvokeServer("CreateNew", args)
end
In the same script at the bottom, I initialize the event handler:
-- Execute server function
if isServer then
print('server call initalized')
ObjectEvents.ExecuteOnServer.OnServerInvoke = function(_player, func, ...)
return ObjectService[func](...)
end
end
Anybody have any clue why the event only invokes like 60-80% of the time?