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!
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.
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…
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).