-- Make sure this script is running in a LocalScript for a player local player = game.Players.LocalPlayer local char = player.Character or player.CharacterAdded:Wait() -- Retrieve all spawnLocations in workspace.Stages local stages = workspace.Stages local spawnLocations = {} -- Add spawnLocations to the list for _, child in ipairs(stages:GetChildren()) do if child:IsA("SpawnLocation") and child.Name:match("^%d+$") then table.insert(spawnLocations, child) end end -- Sort spawnLocations by their number (in the name) table.sort(spawnLocations, function(a, b) return tonumber(a.Name) < tonumber(b.Name) end) -- Check if all spawnLocations are successfully retrieved if #spawnLocations == 0 then warn("No SpawnLocations found in workspace.Stages.") return end -- Track the current spawnLocation index local currentSpawnIndex = 1 local delayBetweenSpawns = 0.01 -- Time delay between each teleportation in seconds -- Function to teleport to the next SpawnLocation after a delay local function teleportToNextSpawn() while currentSpawnIndex <= #spawnLocations do local currentSpawn = spawnLocations[currentSpawnIndex] -- Teleport the player char:SetPrimaryPartCFrame(currentSpawn.CFrame) -- Wait before moving to the next spawnLocation wait(delayBetweenSpawns) -- Move to the next spawnLocation currentSpawnIndex = currentSpawnIndex + 1 end -- Check when all spawnLocations have been passed print("All spawnLocations have been passed.") end -- Initial teleportation to the first SpawnLocation char:SetPrimaryPartCFrame(spawnLocations[1].CFrame) -- Start the teleportation process with delay teleportToNextSpawn()