Hi. Im messing around with a tower of hell kit, seeing how they get the tower to spawn, and I have noticed that sometimes the tower spawns in the air, and not directly above the lobby where it should start:
This is what it should be like:
the position of the first level when spawning in the air is (x, 388.613, z) (first picture).
and the position of the first level when spawning properly is (x, 108.613, z) (Second picture).
Every level has a part in the centre of the model (made it pink so that you can see it) that is the height of the level:
(there is also a value in each model with the height of the level).
Here is the script that generates the tower.
The tower usually generates correctly but every now and then has the issue. Every level has a PrimaryPart, and I have double checked each height variable and centre part. I still cannot figure out why this is happening…
function NewTower()
debounce = true
Floor1 = Stages[math.random(1, #Stages)]:Clone()
Floor1.Parent = Tower
Floor1.PrimaryPart = Floor1:FindFirstChild("center")
Floor1:SetPrimaryPartCFrame(Floor1.center.CFrame)
local Floor1Height = Floor1.weight.Value
wait()
Floor2 = Stages[math.random(1, #Stages)]:Clone()
Floor2.Parent = Tower
Floor2.PrimaryPart = Floor2:FindFirstChild("center")
Floor2:SetPrimaryPartCFrame(Floor1.center.CFrame + Vector3.new(0, Floor1Height, 0))
Floor2:SetPrimaryPartCFrame(Floor2.center.CFrame * CFrame.Angles(math.rad(180), 0, 0))
local Floor2Height = Floor2.weight.Value
wait()
Floor3 = Stages[math.random(1, #Stages)]:Clone()
Floor3.Parent = Tower
Floor3.PrimaryPart = Floor3:FindFirstChild("center")
Floor3:SetPrimaryPartCFrame(Floor2.center.CFrame + Vector3.new(0, Floor2Height, 0))
Floor3:SetPrimaryPartCFrame(Floor3.center.CFrame * CFrame.Angles(math.rad(180), 0, 0))
local Floor3Height = Floor3.weight.Value
wait()
Floor4 = Stages[math.random(1, #Stages)]:Clone()
Floor4.Parent = Tower
Floor4.PrimaryPart = Floor4:FindFirstChild("center")
Floor4:SetPrimaryPartCFrame(Floor3.center.CFrame + Vector3.new(0, Floor3Height, 0))
Floor4:SetPrimaryPartCFrame(Floor4.center.CFrame * CFrame.Angles(math.rad(180), 0, 0))
local Floor4Height = Floor4.weight.Value
wait()
Floor5 = Stages[math.random(1, #Stages)]:Clone()
Floor5.Parent = Tower
Floor5.PrimaryPart = Floor5:FindFirstChild("center")
Floor5:SetPrimaryPartCFrame(Floor4.center.CFrame + Vector3.new(0, Floor4Height, 0))
Floor5:SetPrimaryPartCFrame(Floor5.center.CFrame * CFrame.Angles(math.rad(180), 0, 0))
local Floor5Height = Floor5.weight.Value
wait()
End.PrimaryPart = End:WaitForChild("center")
End:SetPrimaryPartCFrame(Floor5.center.CFrame + Vector3.new(0, Floor5Height), 0)
End:SetPrimaryPartCFrame(End.center.CFrame * CFrame.Angles(math.rad(180), 0, 0))
debounce = false
end