Making a Baseplate generated out of parts

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I am trying to make a baseplate get generated out of parts (Size is for example 4,6,4)

  2. What is the issue? Include screenshots / videos if possible!
    Well, uhh. I am trying to make a baseplate get generated out of parts right…?
    Right. But it generates a cross instead??


I remember seeing a tutorial on how to make what I want, but i think I lost it.
Here is the code

local Origin = Vector3.new(0,0,0)

local AmountParts = 30
local spawned = 0
local function addPart(pos)
	
	local part = Instance.new('Part', workspace)
	part.Size = Vector3.new(4,6,4)
	part.Anchored = true
	part.Position = pos
	
	spawned += 1
	
	return part
end

for x = 0, AmountParts/4, 1 do
	for z = 0, AmountParts/4,1 do
		task.spawn(function()
			addPart(Origin + Vector3.new(4 * x, 0, 0))
		end)
		task.spawn(function()
			addPart(Origin + Vector3.new(-4 * x, 0, 0))
		end)
		task.spawn(function()
			addPart(Origin + Vector3.new(0, 0, 4 * z))
		end)
		task.spawn(function()
			addPart(Origin + Vector3.new(0, 0, -4 * z))
		end)
		print(spawned)
	end
end
1 Like

Try

AddPart(x * 4, 0, z * 4)

Instead of doing that four times


works a bit better but uhhhhh

1 Like

Hang on i just realised the for loop isnt correct i will edit this message soon

for x = -AmountParts, AmountParts do
	for z = -AmountParts, AmountParts do
		addPart(x * 4 - 4, 0, z * 4 - 4)
		print(spawned)
	end
end

I subtracted it with four otherwise the baseplate will be off center

1 Like

thanks alot man (GOD I HATE THIS CHARACTER LIMIT)

1 Like

No problem!
I’m not sure if you really need to subtract the x and z with four but you will figure that out :smiley:

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.