Before player spawn you must:
1. Get SpawnX
2. Get SpawnZ
3. Load chunk.
4. Detect (get) free height (SpawnY) bloks for spawn player.
5. Teleport player to SpawnX, SpawnY, SpawnZ.
Sample code:
1. Get SpawnX
2. Get SpawnZ
3. Load chunk.
4. Detect (get) free height (SpawnY) bloks for spawn player.
5. Teleport player to SpawnX, SpawnY, SpawnZ.
Sample code:
-- ... -- Get world default spawn point local world = cRoot:Get():GetWorld("world2"); local SpawnX = world:GetSpawnX(); local SpawnZ = world:GetSpawnZ(); -- Get player last bed position local PlayerX = (-8); local PlayerZ = 3; local OnAllChunksAvailable = function() console_log(func_name .." -> chunks redy for player ID ".. a_player:GetUniqueID(), 1); a_player:MoveToWorld("world2"); local ret1, SpawnY = obj_world:TryGetHeight(SpawnX, SpawnZ); a_player:TeleportToCoords(SpawnX, SpawnY , SpawnZ); a_player:SetGameMode(1); end world:ChunkStay({{PlayerX, PlayerZ}, {SpawnX, SpawnZ}}, OnChunkAvailable, OnAllChunksAvailable); -- ...