I’ve been trying to make a loading script because players are spawning before the map is fully loaded.
The map generation works by procedurally generating random terrain as tiles.
I need something that will wait for each tile to be loaded in.
I’ve attempted to use descendant added and waitforchild. None of those worked.
If anyone knows a way I can do this please tell me. If one of the things I mentioned above does work please tell me how to make it work.
Here is my script:
local loadEvent = game:GetService("ReplicatedStorage"):WaitForChild("Load")
local player = game:GetService("Players").LocalPlayer
loadEvent.OnClientEvent:Connect(function(folderToLoad,expectedNumber,anchorPlayer)
local character = player.Character or player.CharacterAdded:Wait()
if anchorPlayer then
local torso = character:WaitForChild("Torso")
torso.Anchored = true
end
if anchorPlayer then
local torso = character:WaitForChild("Torso")
torso.Anchored=false
end
end)
The empty space is where I would put the script that waits for all parts to be loaded in.