Placement System more efficient

Hei Developers
I recently watched some tutorials on Youtube about Sandbox Tycoons to introduce my knowledge to start creating for real, I learned to make the system of giving the player automatic plot, the placement, etc.
–total credits for zblox
However, I feel that my system is consuming a lot of memory, mainly because for each object I create, I need to put a script inside it

this is my current script in
StarterGUI> ScreenGui> LocalScript:

local player = game:GetService("Players")

    local replicatedstorage = game:GetService("ReplicatedStorage")

local player = player.LocalPlayer

local mouse = player:GetMouse()

local modules = replicatedstorage:WaitForChild("modules")

local models = replicatedstorage:WaitForChild("models")

local signals = replicatedstorage:WaitForChild("signals")

local remotes = signals:WaitForChild("remotes")

local functions = remotes:WaitForChild("functions")

local functionRF = functions:WaitForChild("requestPlacement")

local getPlot = functions:WaitForChild("requestPlot")

local placementModule = require (modules:WaitForChild("PlacementModuleV3"))

local placement =



Enum.KeyCode.R, Enum.KeyCode.X, Enum.KeyCode.U, Enum.KeyCode.J


local button =

local plot = getPlot:InvokeServer()

local plotOBJ = plot.plot

local itemHolder = plot.ItemHolder

local function place(obj, stack, rot)

placement:activate(obj, itemHolder, plotOBJ, stack, rot)



place("part", true, false)





saw that for each object I need this giant script … Is there any way to create a system where I create a value associated with the object? and how do I insert this into my script?
Thank you very much in advance

1 Like

You can just use

for i, v in pairs(Objects:GetChildren()) do
--your script

This will solve your problem Ig


I will try to use this thank you very much, but would I have to modify anything in my script? or put some intvalue on the objects ??


I didnt read the whole code but basically this piece of code will loop through all Objects and you can make them to work with one “script”
for example I want to get all objects in Workspace with name “TestObjects”

local WS = game:GetService("Workspace") 
local CountOfChildrens = 0

for i,v in pairs(WS:GetChildren()) do --loop through all objects in workspace 
if v.Name == "TestObjects" then --if Name is TestObjects then it will add +1 to Count of Children variable
CountOfChildrens += 1
print(CountOfChildrens) --number of childrens

oh yes,i I understand what you mean, i already have a place to start, thank you very much

No problem I hope it will helps you like it helps me when I learnt how to use it :wink:!

1 Like

hmm the code looks good it seems. A bit hard to read, but besides that I think its fine.

is there something that I’m not catching about your concern? can you elaborate?

1 Like

is because when I associate it with another object, i make like:


place("part", true, false)
---new Object
place("chair", true, false)

when I associate the new place button with the “chair” I can’t access the other “part” and it just disappears