Creating A Furniture Placement System

2 year old thread, so without reviewing the code:

Use a RemoteEvent:FireServer(placementLocation) to tell the server where placement is being requested by the client. Copy the Placement code into a Script in ServerScriptService, add code to connect a callback function to that same RemoteEvent. Inside that function, call your placement code.

4 Likes

thanks, i got it working good :smiley:

I’m having trouble with reading this post. What do you mean by “Server Twin” exactly?

1 Like

For anyone who has used this does this save well when you have like 400+ items placed?

hello there!!
Well, im kind new to scripting, so i apologize if i say something that is kind silly…
So, i was able to run your code to my game, but im trying to do a little different, i want a that the player can only place a part on the floor, if he has the tool’s part. So, if he has the tool “bed” he can place on the floor…
The first part, i was able to do. Now the player can only place when he has the tool, the problem is that im doing a :unequipped so when the player unequipps the tool, the clone item on the client side :destroy, and im doing a couple of checks so if there is no cloned tool on the client, the functions stop running… But, with that, im having a trouble with the RunService RenderStepped, it keeps running and gives me a error saying that the model is nil, cuz i deleted…
also, when i delete the tool and click, even like that it keeps firing the model script and gives errors cuz, again the model is nil…

any ideas on how to stop the renderstepped and how to stop the model script to be called?
any topics i can read to help me?
Thanks and i hope everyone is safe!

1 Like

Store the connection, then disconnect it when appropriate.

becomes

local connection = game:GetService("RunService").RenderStepped:Connect(function(dt)

and then later disconnect the connection

connection:Disconnect()

3 Likes

Thanks a lot!!!
one last question, how can i stop the module after i require?
cuz once i equip the tool, it keeps requiring the module, even if i unequip the tool.
do you think if checks would work?
like, if clientClone ~= nil then…

I dont know if there is a way to stop a module to be required after require.

Once a ModuleScript is called by require, that module runs and stays in memory until the client or server that required it stops running.

You need to add or modify code in the module, or in the code that uses the module, or both in order to handle whatever cases your game needs to handle. You can add methods or functions to the module, you can add events.

In your case when a tool is unequipped, you need to add code that changes the game state to undo whatever the module does when the tool is equipped.

1 Like

Most of this tutorial is great! I dont understand the math behind it but thats ok. The only thing I find a very slightly off about this tutorial is that you put the serialization functions in the placement system module. I feel the placement system should be done separately from the saving system. The placement is a completely different feature than a saving system and should not be mixed (In my opinion).

2 Likes

I actually had the same though. I already have a script for saving data, so now, im trying to figure out how to make it so all the saving system is in one and the placement system in another script. But im having a hard time trying to figure out how.

1 Like

Is anyone else having trouble with the objects not colliding with eachother? I did exactly as the script said and tried to change a bit, but to no avail (I edited the localscript too)

Great tutorial! Gonna come back to this when i fully learn scripting

When you make really small rotations, the object goes off the canvas. Is there any way to fix this because it is a pretty big problem D:

all hail egomoose

15 Likes

Great OOP tutorial. Helped me alot.

2 Likes

This is something I have wanted to do for such a long time.
I will read it about 30 more times and then try it. LOL.

Very nice tutorial.

1 Like

Hi, so I’m working on my own placement system and came here for some guidance in clamping objects to boundaries (vector3’s/region3 in my case) with accounting for part sizes, but I’m a little unclear as to why did you convert the canvas cframe so the lookVector is facing upwards? Is it for easier saving purposes? Also, for the size clamping to worh, I basically need to convert the sizes from object space to world space or to “canvas space”, correct?

2 Likes

The forward vector of a cframe is the Z axis for that objectspace. Perhaps it is just to make 2dim math more intuitive.

2 Likes

what about stack the items one on top the other, how can i do that?

im thinking on doing a new method like the :CalcCanvas() but this time the canvas is the object that is already placed, but how can i do that? how can i check if the new object is touching another object and if it is, then it should do another math, calculate the hight of the placed object maybe? im lost :frowning:

Change the primary part to something in the center of the model

1 Like