So basically, a module handles all the stage generations, but when it comes to spawning the normal stages difficulty stages it has kinda gone horribly wrong
lol-
The code is this:
if #lastMapGeneratedFolder:GetChildren() == 0 then
clonedMap:SetPrimaryPartCFrame(CFrame.new(startingPart.Position), Vector3.new(0, 0, 0))
local lastMapGenerated = clonedMap:Clone()
lastMapGenerated.Parent = lastMapGeneratedFolder
else
for _, lastMapGenerated in pairs(lastMapGeneratedFolder:GetChildren()) do
print(lastMapGenerated)
clonedMap:SetPrimaryPartCFrame(CFrame.new(lastMapGenerated.Finish.Position), Vector3.new(0, 180, 0))
--CFrame.lookAt(lastMapGenerated.PrimaryPart.Position, lastMapGenerated.Finish.Position)
local lastmapGenerated = clonedMap:Clone()
lastMapGenerated:Destroy()
lastmapGenerated.Parent = lastMapGeneratedFolder
end
end
Basically, it checks when there is no map in the “lastMapGenerated” folder, when there is no map it sets the stage’s position to the Starting Position of the stage, else if there is a stage in the folder, it checks it’s “finish” part position and makes the current stage that is being cloned go to after that position but it somehow goes to the second “2nd Stage” I thought it was a problem of the rotation but it doesn’t seem to be the problem tho.