Building logic, 4X4X4 building system

Hello,
Im working on building system, but i ran into problems,
How do i make 4X4X4 building grid? (Blocks can be paced only 4 studs from each others center)
exmaple:
original value = 2,3,4
some code
new value = 4,4,4
or
original value = 31,3,36
some code
new value = 32,4,36
i need that some code

1 Like

I did not mean that, i meant for live game building system, where players can build their factory,
I need some way of making placement only 4 studs away in grid,
exmaple:
original value = 2,3,4
some code
new value = 4,4,4
or
original value = 31,3,36
some code
new value = 32,4,36

I dont know can i explain it well with my bad English…

He is talking about making a live building system for his players to build with.
He doesn’t need the tools, he needs to script them.

1 Like

Discord guy (OofTheory #0832) gave me this code

a = 250
b = 4
c = 4

function round(n)
	return math.floor(n + 0.5)
end

function round4(n)
	return 4 * round(n / 4)
end

function lockGrid4(x, y, z)
	return round4(x), round4(y), round4(z)
end

print(lockGrid4(a, b, c))

i tested it with high numbers and it works with no problem.

2 Likes