I’m experiencing a race issue where my server-side is loading its scripts much faster than my client-side scripts, so when my server-side script fires a Remote Event, my client-side script does not receive it because it has not finished loading yet. Is there a way for my server to detect when the client has finished loading before firing the RemoteEvent?
Try using a remotefunction instead. When the client is loaded, have them fire the remotefunction and have the server return the value you were trying to fire in the first place
This would be a good method, but is a very bodgy fix, another method is getting all players and wait until character is loaded, or if there is a specific player for the fact, wait for the character to load on that player.
Client-side varies per player, so @OttodotOfficial would need to factor this into their method. This also has to do with ping, so some clients may load in quicker then the server, where as others wont, once server is loaded, it stays loaded until shut down so this issue is only really with in the first player joining, @OttodotOfficial can we please get more information into what you are trying to achieve scripting wise so we can better support you in getting a method?
this would be:
player.CharacterAdded:Connect(function()
end)
So when my player is added, I will access the datastore to get the number of coins the player has. Upon retrieving the amount of coins successfully from the datastore table, I will fire a Remote event to update all the UI components that show my player’s coins. However, only 1 out of 2 of my scripts receive the event as the other script hasn’t loaded after the Remote event fire from the server.
I have tried firing the Remote event after the character is added, however, not all the scripts has finished loading as well. So only 1 out of 2 of my scripts received the event.
Respectfully disagree. I think @cyberplanet1870’s solution is a clean and simple fix.
The client knows when it’s done loading, just have it tell the server that.