Alright, in order to go about this, we first must know the fundamentals of a part, or.. in otherwords, where it's position is stated.
A part's position is the middle of the part... in otherwords, any sides position, subtracted by half of the part's size on that axis.
In order to see whether it should be able to be placed, we will create a function, but also have a table to check whether any of these parts can be added.
function check(model,player,location)
end
Here, we have created a function, it will check the model's parts, the player who owns a lot, and the location of all the parts they can build above.
Now, we must get all the models parts, and check for all of the locations available build areas...
function check(model,player,location)
for index,parttocheck in ipairs(model:GetChildren()) do
for index2,locationtocheck inipairs(location:GetChildren()) do
end
end
end
If you need help on checking the x and y coordinates of the parttocheck variable, and the locationtocheck variable, I can help... just ask. ;)
ELunate has given a great explanation on how to do this though, check her explanation out!
Make sure to accept and upvote this if I helped you!
Thanks, Taryo
1 comment
Check the items position, and whether it (-1/2 of it's size) would work on top of a floor brick, then it can be placed.