Hello! I hope you are all doing well. I am creating an endless obby, however, this will not choose a level. it works when I make it 1 level and not 2:
level = {
"Land0",
"OtherLevel"
}
local repStor = game:GetService("ReplicatedStorage")
local Land = repStor:WaitForChild("ObbyLevels"):FindFirstChild(math.random(#level))
local new_land = Land:Clone()
new_land.Parent = game.Workspace
new_land.Name = "Land1"
maxland = 5
for i = 1, maxland do --Doing for loop for testing
Land = repStor:WaitForChild("ObbyLevels"):FindFirstChild(math.random(#level))
print("Working", i)
local oldLand = game.Workspace:FindFirstChild("Land"..i)
local new_new_land = Land:Clone()
new_new_land.Name = "Land"..i + 1
new_new_land.Parent = game.Workspace
new_new_land:SetPrimaryPartCFrame(oldLand.ThePrimaryPart.CFrame * CFrame.new(94, 0, 0))
wait(5) -- To prevent crashing... Had to learn that the hard way.
end
Here is how ReplicatedStorage is layed out out:
Here is the error im getting:
If you can help, please let me know. Thanks, WE