function DataService.init(self: DataService)
ReplicaClient.OnNew(Globals.REPLICA_PLAYER_DATA_TOKEN, function(...: any)
onNew(self, ...)
end)
ReplicaClient.RequestData()
end
function DataService.awaitData(self: DataService): any
if not self._data then
self._dataReady:Wait()
end
return self._data
end
return DataService
I know this is a little dumb, but I’m making a client data module. I load all my modules in a random order, so if I have another module that loads before this and calls :awaitData(), it will cause the script to yield infinitely without it even initializing first.
I would just do something that make sure its initialized when calling that function, but I feel like that’s just a sign of bad design (In case I have other functions that yield, or other modules that have similiar behavior)