How to wait until a bunch of model loads properly?

So the game requires me to make a grid layout but once I do It takes a while to load everything up. But How can I wait before teleporting players into the grid? because If I don’t the player instantly teleports to a point and falls into the void.

local AutoPlotGrid = 2*#Humans+1 -- Don't care about this
	OnPlotGeneration(AutoPlotGrid, AutoPlotGrid) -- This generates the grid
	
	for i, clients in pairs(Humans) do
		if workspace:FindFirstChild("Plot_Terrarin") then
			for i, house in pairs (workspace.Plot_Terrarin:GetChildren()) do
				if house.Name == "House of "..clients.Name then
					if house.Base:FindFirstChild("SpawnPoint") then
						clients:SetPrimaryPartCFrame(house.Base:WaitForChild("SpawnPoint").CFrame) -- Teleports the player
					end
				end
			end
		end
	end	

OnPlotGeneration Function below,

OnPlotGeneration() -- I haven't included the whole script but this is all you need to care about and is having a problem with the teleportation.
 for Axis_X = 1, x do -- Columns
		for Axis_Z = 1, z do -- Files
			local randNum = math.random(1, #Configured_Plots)
			print( randNum, Configured_Plots[randNum])
            random_P = Configured_Plots[randNum]:Clone()
            random_P:SetPrimaryPartCFrame(CFrame.new(Axis_X*35, 0, Axis_Z*35)*CFrame.Angles(0,math.rad(90*math.random(1,4)),0))
            random_P.Parent = file
            table.remove(Configured_Plots,randNum)
        end
	end
	return 
end

Maybe one of these would help -

1 Like

Sorry my mistake the title wasn’t appropriately written. I already know what you’ve given me. and those isn’t what I am looking for… sorry

1 Like
1 Like