Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Place objects in grid based area?

Asked by
Cuvette 246 Moderation Voter
8 years ago

I've made a script in which when a player joins the game and finds a plot of land. They can build on it using a tool which places down a model wherever they click. This all then saves to a datastore and loads back up the next time they join.

The only problem is, i'm trying to make it so that they can only place within tiles in an area (e.g. a 512x512 baseplate split up into 32x32 tiles) Just so that things can be aligned and there's no messiness in the placing of models. But how would I go around doing this?

EDIT: Just thought of a better way of explaining this, lets just say I wanted to move the model 1 stud at a time. Because right now it just places wherever I click and doesn't snap to the grid

1 answer

Log in to vote
-1
Answered by 8 years ago

How I would do this is to use FindPartsInRegion3

So I would test place the block then remove it if it's not found after its been placed.

There are probable better ways of doing this but I don't know your game design.

For your scaling of 32X32 you will need to make a script that will round to the nearest multiple of 32 giving you the grid effect.

Hope this helps.

Ad

Answer this question