#Waiting for instances to load inside a module script

1 messages · Page 1 of 1 (latest)

short solstice
#

I need to yield the thread before making a table because a dependency (the model inside workspace) has not loaded in. I tried doing a repeat loop with Game:IsLoaded() but it didnt do jackshit because its already loaded or true but when i then print what i need to be loaded it is still not there.

print("waiting")
repeat task.wait() until game:IsLoaded()
print("ended", game:IsLoaded())
local provinces = game.Workspace.Map
print(provinces:GetChildren())

local ProvinceConnection = {
    {Name = "1", DisplayName = "", Model = provinces["1"], Neighbours = {"2","18","19"}};
    {Name = "2", DisplayName = "", Model = provinces["2"], Neighbours = {"1","19","36","20","3"}};
    {Name = "3", DisplayName = "", Model = provinces["3"], Neighbours = {"4","11","20","2","5"}};
    {Name = "4", DisplayName = "", Model = provinces["4"], Neighbours = {"3","5"}};
    {Name = "5", DisplayName = "", Model = provinces["5"], Neighbours = {"4","3","11","12","13","6"}};
...
}

return ProvinceConnection
#

While i could just do task.wait() with an arbitrary number its only a bandaid fix

#

Ive just tried using Game.Loaded:wait() too and it yields the script and doesnt resume even after the game is loaded

slow portal
short solstice
turbid shale
#

streaming enabled

#

its on by default @short solstice btw

short solstice
#

how do i disable that

#

did they move it from the properties tab

turbid shale
#

workspace.StreamingEnabled

short solstice
#

my god it worked

#

ty so much

turbid shale
turbid shale
slow portal