How can I make it so that you can't place an object an top of another object?

  1. What do you want to achieve? Keep it simple and clear!
    I want to know how I can make it so that I can only place an object on the first level, and not on top of parts.

  2. What is the issue? Include screenshots / videos if possible!
    I don’t know how to do it.

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I have tried YT and Devforum.

Here’s a video showing what I DO NOT want:

Here’s a video showing what I want:

1 Like

May i recommend this post?

You can use mouse.TargetFilter To ignore certain parts/models etc.

2 Likes

that not rlly what i mean, its kinda hard to explain but its basically: you cant place objects on the second level, so like if you place a part that would be level 1 and if you put another one ontop of it thats level 2. so i want it so that you cant place objects on level 2

Still, it’s basically how you would do it. Just set TargetFilter to the objects on floor 2.

Placement System Tutorial - P4 (Roblox Studio) - YouTube here at 9:37, in this video it basically shows what i want to do, i want items to not be able to stack on top of another

but that’s what im saying, TargetFilter will prevent the player from stacking objects.

ok lemme try this and ill let you know if it works

it doesn’t work i can still stack objects

Can you show me the code you are using for the mouse?

local Mouse = game.Players.LocalPlayer:GetMouse()
local folderToFilter = workspace:WaitForChild(“FolderToFilter”)
Mouse.TargetFilter = folderToFilter

It should be

Mouse.TargetFilter = folderToFilter:GetChildren()

or Mouse.TargetFilter = folderToFilter:GetDescendants() if you have models.

i get this error: Unable to assign property TargetFilter. Object expected, got table

Oh yeah i forgot. It has to be a object and not a table so it is actually the right thing. It should work if tthe parts or models are inside the folder. cause it seems to be working for me

yea, im only putting parts and unions inside of the folder but it still doesnt work

Do you get any error messages or does it just not work at all?

i got this error Unable to assign property TargetFilter. Object expected, got table

but that shouldn’t happen if you are using this code

local Mouse = game.Players.LocalPlayer:GetMouse()
local folderToFilter = workspace:WaitForChild(“FolderToFilter”)
Mouse.TargetFilter = folderToFilter

it is not working and i am using that exact code

just also tried using a folder. Idk why but it only works with a model, but that shouldn’t be a issue if you are using it in a script

OOHH, i tried using a model too and it worked, i just need to adjust my one script