Wait for environment to load after SetEntityCoords()

Hi,

Is there a method to check if the environment is fully loaded for a player?
For example, my spawn script teleports the player to an MLO, but when initially joining the server, players can see through (from) the bottom of the map, and the MLO loads a few seconds (on my machine) after spawning.

I can obviously do a Wait(x) with some arbitrary value to guess when the environment has loaded, but I rather build my teleport function to wait with DoScreenFadeIn until the environment is fully loaded/rendered.

Does such a function exist?
My apologies if this is in the wrong section, and thank you for the feedback!

I believe some of the LoadScene functions should be able to check for this.

Thank you for your reply.
I’ve been checking out the different LoadScene functions, but from the documentation (read examples) I’m not sure what you’re referring.

Could you elaborate?

or

if not, take a look at this, it doesn’t check if its loaded, however it force loads the area, and with it, the ground collision.

what? where is playerLoaded documented? are you refering to playerSpawned?
And the code you’ve given will print the text when the player is in the game and not dead, which is not what the author asked for…

The post above (which the author deleted since) looks like a made up answer by ChatGPT. *sigh*

1 Like

Right - from a GitHub code search I found a result similar to the following:

    NewLoadSceneStart(x, y, z, 0, 0, 0, 50.0, 0)

    local sceneLoadTimer = GetGameTimer()
    while not IsNewLoadSceneLoaded() do
        -- timeout in case it takes *very* long
        if GetGameTimer() - sceneLoadTimer > 5000 then
            break
        end

        Wait(0)
    end

    NewLoadSceneStop()

This should ensure the world around x, y, z is loaded (and remains loaded until using NewLoadSceneStop, in case you want to preload a coordinate elsewhere).

1 Like