Help with sending multiple parts

Local Script

local placementHandler = require(script:WaitForChild('PlacementModule'))
local base = workspace.Bases:FindFirstChild(player.Name)
local plane = placementHandler.new(base.Base, base.ItemHolder, 1)

ModuleScript

module.new = function(sentBase, obstacles, grid)
	local plane = {}
	plane.base = sentBase
	plane.obstacles = obstacles
	plane.position = sentBase.Position
	plane.size = sentBase.Size
	
	if (math.floor(.5 + plane.size.X/grid) % 2 == 0) then
		plane.offsetX = -grid/2
	else
		plane.offsetX = 0
	end
	
	if (math.floor(.5 + plane.size.Z/grid) % 2 == 0) then
		plane.offsetZ = -grid/2
	else
		plane.offsetZ = 0
	end
	
	
	plane.stateEvent = Instance.new("BindableEvent")
	plane.stateChanged = plane.stateEvent.Event	
	
	plane.grid = grid
	plane.enable = enablePlacement
	plane.disable = disablePlacement
	plane.rotate = rotate
	plane.place = place
	plane.setLoading = setLoading
	
	return plane
end

I tried to only show what I believe is the important parts to the scripts. The problem I’m facing is atm I’m wanting to send multiple parts in the plane as the ‘Base’,

placementHandler.new(base.Base,…

base is the Model, and Base is a part. Now I want to let the purchase further plots in the future, but I don’t know how to make it to add another base to the plane. I tried just making the base part a lot larger and just putting parts ontop of it to prevent players from placing items on that part, put they still do (I’m trying to make a placement a system, like Sandbox, Theme park tycoon, etc.)

Any help or info would be appreciated

2 Likes

Hello! You could possibly create another table in your dictionary! That way you could store as many bases inside the “Bases” Table, inside the “plane” dictionary.

No need for a dictionnary, because you could place them in order with table.insert.
So to get your bases, you’d need to do something like this:

print(plane[“Bases”][BaseNumberGoesHere].Name)

Hope this helps.

Is your grid based off of a physical part(s) or solely in the script?

Personally I would just have the grid as one big thing and then group it into sections (think chunks from Minecraft) that can be unlocked

Since you are using @Tunicus’ placement system, you are unable to have multiple planes. As I’m using the exact same placement system for a side project of mine, I also ran into the same issue as you. I talked to Tunicus about ways to possibly fix it and he gave me a solution that worked for my use case and might work for yours:

As a side note, you should give credit to Tunicus as he made the placement system that are you are trying to “make.”

4 Likes

Yea i have in game, and Im slightly confused as to what he means in that explanation

Using a table as value in an existing table is not a metatable. Your example is a dictionary with tables as values.

Lua metatables;
https://www.lua.org/pil/13.html

Ouch.

Still works tho.

Does it really work?

It would need some tweaking, but I can definitely see it work.