Plot building system

Hi everyone, I feel like I now have the experience to script a plot system like lumber tycoon where you can build anywhere on it with a grid. I obviously want to add all the security needed to keep plots safe.
Except a 10h long playlist that asks us to copy the script as is, I found no real guidance on how the system should normally work.

QUESTION: How would I be able to detect in a good manner whether the block placed by the player is within the plot’s bounds?
I already taught about adding invisible border parts around to detect if any placed furniture would end up outside the build region.

P.S.: *All the objects will have a hitbox in rounded studs measures to make the grid placement easier. This being said, I will only have to keep an invisible hitbox part that the server will be able to track whether other parts are touching or not. *

Feel free to add some ideas to the discussion.

1 Like

You could possible clamp the X, Y, Z values of the location to the edges of the plot ig

Region3 is an option, else getting all the corners and checking if they are inside will work.

1 Like

Oh wow it was obvious. Its exactly the answer I needed. Thank you!

For the ones who want further explanation:
We can make a region3 above the plot to limit where the player can build, then we create 2 points based on 2 opposite of the hitbox and check whether those 2 points are within the region3. To find these points we can just use make a vector3 with the hitboxs size divided by 2 and then add it to the objects original position. This will give us 2 position to check.

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