How I can make stages connect perfectly?

How’d! My name is Bunnyh :rabbit:! I’m currently creating an ToH like game and whenever I set the stages height equally (e.g.: 40) it works perfectly, but if I set different heights (like 23,60) it leaves a big gap or it glitches inside other stages.

some pics:

also don’t worry with the shiftlock icon on the screen lol

So, any thoughs?

                                                             -- Bunnyh

I would use a plugin called archimedes. It makes perfect circles.

plugin: Archimedes (v3.1.9) - Roblox

1 Like

I used F3X tool to make the walls, how I can make stages connect perfectly without leaving gaps or glitching

^^^
This is what I mean

I would use archimedes to make a perfect circle then clone it and make it a different color because it looks like u didn’t align properly which causes the glitch.

EDIT: try making guiding parts to align your main parts correctly.

I made an video showing how I made the walls:

robloxapp-20201018-0102043.wmv (638,3,KB)

I’ll use Archimedes and see what happens

I think OP is talking about the height of the stages.

oh, ok u can try doing this then

U can try seeing what the y axis size is then adding it to the position.

I will try to make a script to show u.

I tried to make this from my mind so it prob not that accurate to what u want.

local Stage = YourStage
local LastStage = StageBelow --You Can Do math.random to pick a stage below

Stage.Position = LastStage.Position
Stage.Position.Y = Stage.Position.Y + Stage.Size.Y

Probably not the most effective, but store the height, you could use a numbervariable, or just get the height of one of the walls, and then store your stages in a folder, numbered 1 to 6 or whatever your amount of stages is, and then iterate through using a loop using something like this:

local stageFolder = workspace.mySelectedStages
local heightToAdd = stageFolder['1'].Height.Value -- initial stage, if it's 12 studs tall, each of the stages will be moved up 12 studs
local loadedStageFolder = workspace.loadedStages
stageFolder['1'].Parent =  loadedStageFolder

for i,v in ipairs(stageFolder:GetChildren()) do
   for i2,v2 in pairs(v:GetDescendants()) do
        if v2:IsA('BasePart') then
            v2.Position = Vector3.new(v2.Position.X, v2.Position.Y + heightToAdd --[[remember that old number value from earlier? If it's 12, then each of the parts should be moved up 12 studs.]], v2.Position.Z)
            v.Parent = loadedStageFolder
        end
    end
    heightToAdd = v.Height.Value -- that value that determines the stage's height, but for the current stage, which would be stage 2.
end

lol now I feel like my script is horrible

yes I made it, here’s an better explanation:

I have 9 stages in an folder on ServerStorage called ‘Stages’, each stage have an NumberValue called ‘Height’, which contains the size of the stage.

A bit of the script:

function NewTower()
	
	debounce = true
	
	Floor1 = Stages[math.random(1, #Stages)]:Clone()
	local Height1 = Floor1:FindFirstChild("Height")
	Floor1.PrimaryPart = Floor1:FindFirstChild("Center")
	Floor1:SetPrimaryPartCFrame(Floor1.Center.CFrame)
	Floor1.Parent = Tower
	
	wait()
	
	Floor2 = Stages[math.random(1, #Stages)]:Clone()
	local Height2 = Floor2:FindFirstChild("Height")
	Floor2.PrimaryPart = Floor2:FindFirstChild("Center")
	Floor2:SetPrimaryPartCFrame(Floor1.Center.CFrame + Vector3.new(0, Height1.Value, 0))
	Floor2:SetPrimaryPartCFrame(Floor2.Center.CFrame * CFrame.Angles(X, Y, Z))
	
	Floor2.Parent = Tower
	
	wait()
	
	Floor3 = Stages[math.random(1, #Stages)]:Clone()
	local Height3 = Floor3:FindFirstChild("Height")
	Floor3.PrimaryPart = Floor3:FindFirstChild("Center")
	
	Floor3:SetPrimaryPartCFrame(Floor2.Center.CFrame + Vector3.new(0, Height2.Value, 0))
	
	Floor3:SetPrimaryPartCFrame(Floor3.Center.CFrame * CFrame.Angles(X, Y, Z))
	
	Floor3.Parent = Tower
	
	wait()

	Floor4 = Stages[math.random(1, #Stages)]:Clone()
	local Height4 = Floor4:FindFirstChild("Height")
	Floor4.PrimaryPart = Floor4:FindFirstChild("Center")

	Floor4:SetPrimaryPartCFrame(Floor3.Center.CFrame + Vector3.new(0, Height3.Value, 0))

	Floor4:SetPrimaryPartCFrame(Floor4.Center.CFrame * CFrame.Angles(X, Y, Z))

	Floor4.Parent = Tower
	
	wait()

	Floor5 = Stages[math.random(1, #Stages)]:Clone()
	local Height5 = Floor5:FindFirstChild("Height")
	Floor5.PrimaryPart = Floor5:FindFirstChild("Center")

	Floor5:SetPrimaryPartCFrame(Floor4.Center.CFrame + Vector3.new(0, Height4.Value, 0))

	Floor5:SetPrimaryPartCFrame(Floor5.Center.CFrame * CFrame.Angles(X, Y, Z))

	Floor5.Parent = Tower
	
	wait()

	Floor6 = Stages[math.random(1, #Stages)]:Clone()
	local Height6 = Floor6:FindFirstChild("Height")
	Floor6.PrimaryPart = Floor6:FindFirstChild("Center")

	Floor6:SetPrimaryPartCFrame(Floor5.Center.CFrame + Vector3.new(0, Height5.Value, 0))

	Floor6:SetPrimaryPartCFrame(Floor6.Center.CFrame * CFrame.Angles(X, Y, Z))

	Floor6.Parent = Tower
	
	wait()

	Floor7 = Stages[math.random(1, #Stages)]:Clone()
	local Height7 = Floor7:FindFirstChild("Height")
	Floor7.PrimaryPart = Floor7:FindFirstChild("Center")

	Floor7:SetPrimaryPartCFrame(Floor6.Center.CFrame + Vector3.new(0, Height6.Value, 0))

	Floor7:SetPrimaryPartCFrame(Floor7.Center.CFrame * CFrame.Angles(X, Y, Z))

	Floor7.Parent = Tower
	
	wait()

	Floor8 = Stages[math.random(1, #Stages)]:Clone()
	Floor8.PrimaryPart = Floor8:FindFirstChild("Center")

	Floor8:SetPrimaryPartCFrame(Floor7.Center.CFrame + Vector3.new(0, Height7.Value, 0))

	Floor8:SetPrimaryPartCFrame(Floor8.Center.CFrame * CFrame.Angles(X, Y, Z))

	Floor8.Parent = Tower
	
	debounce = false
	
end
1 Like

what I would do is set the base stage to whatever position it is at then I would make the other towers the same x and z and just add the Y size to the Y position which makes it aligned.

Edit: u have to add the Y from the current stage you just can’t keep adding the Y to the base stage or it will all be in one location.

I didn’t got it, could you explain it?

Yeah, that works! Instead of creating a new variable for each of the stages though, you could do a simple loop, and then just save the stages in a table, using something like this. Not perfect, but should work for you, probably needs a bit of touching up though as I’m writing this out of studio, not sure if I have the heirarchy correct either.

local stages = {}
for i = 1,8 do
    stages['Stage'..i] = Stages[math.random(1, #Stages)]:Clone()
	local Height = Floor:FindFirstChild("Height")
	stages['Stage'..i].PrimaryPart = Floor:FindFirstChild("Center")

    stages['Stage'..i]:SetPrimaryPartCFrame(stages['Stage'..i - 0].Center.CFrame + Vector3.new(0, stages['Stage'..i - 1]Height.Value, 0))

	stages['Stage'..i - 1]:SetPrimaryPartCFrame(Floor.Center.CFrame * CFrame.Angles(X, Y, Z))

    stages['Stage'..i].Parent = Tower
end

Your stages will still be easily accessible, however you can easily change the amount of stages you want. Also easier to read IMO, but should do the exact same thing.

1 Like

doesn’t seems to work… :confused:

1 Like

Are there any errors in the output?

I was trying to fix your code to make it fit with the rest of the code, and one of the errors I got was 01:32:42.863 - ServerScriptService.GameScript:127: attempt to index nil with ‘Height’

1 Like

Also I tried using :FindFirstChild() and :WaitForChild() and both doesn’t worked

1 Like

Thanks for the info! Maybe try checking if stages['Stage'..i - 1] exists, and if not, just skip to the next iteration, or store that height as a value, and then skip to the next iteration. I believe that is the error you are encountering.

1 Like