Grid system inside plot

  1. What do you want to achieve? So I have a building game where each player has a plot, that and that. I currently have a snap to grid but I want it to work just like Bloxburg did it, basically just snap to grid but its like… I don’t know… integrated into the plot or something…?

This is the current snap to grid I’ve got:

local function roundToGrid(num)
	return math.floor(num / GridSize.Value + 0.5) * GridSize.Value

All the bases of the plots are the same size as seen here, HOWEVER, I don’t want the part that the player is placing to go outside of the plot, aka outside or inside the black borders you see, if that is possible:

1 Like

This can help?

1 Like

That’s exactly what I need but there’s no tutorial in the video, it’s just a showcase.

Make the size limit of your plots 1 ‘square’ (the size of your placed items) smaller.
If you have a 100 x 100 stud plot and your squares are 10 studs then make the placement grid size 90 x 90, centered in the same spot as your 100 x 100 plot.

Also, math.round has replaced the equation you have for math.floor. Anything that saves a nanosecond of calculating time helps!

Just needed to know what you meant.
This seems perfect for you then

There’s no grid system in that tutorial though.

I’d probably like to understand the math behind snap the part to the grid instead.

Sorry, from your description I thought you meant you already had the snap to grid system working and just needed the limits for it.
There are lots of posts about snap to grid building systems in the forums. You’ll probably get some good information in those posts.

local function snapToGrid(part)
part.CFrame =, roundToGrid(part.Position.Y), roundToGrid(part.Position.Z))

Also, if possible, I’d like if it made the grid inside the plots like so:


Just go inside the function and make it take in two arguments:
local function roundToGrid(num, size)
return math.floor(num / size + 0.5) * size

When you call it, call it like this:
roundToGrid(part.Position.X, GridSize.Value)