You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear!
I’m making a game where which ever team puts the most models inside an area, as parts are added or removed from inside the part,
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
Using GetTouchingParts(), but couldnt figure out how to make it not count duplicates if theyre in the same model.
You could the touching parts’ parent to determine which model it is in. If your model has nested parts inside it, then you can use the FindFirstAncestorWhichIsA function that finds the touching parts’ ancestor with the specified Class.
But if you have a model inside a model, I’ll try my best to find another solution. There might be an answer in the forum.
I just want a count of the models inside of the area of my part, think of the part like a trash can, I want a score of how many models are in this trash can.
You can use my answer above to try. GetTouchingParts can only get all the descendants, that are BaseParts, inside the models. FindFirstAncestorWhichIsA(“Model”) gets the closest Ancestor of the part that is a Model.
Maybe your part has CanCollide turned off. GetTouchingParts also can’t detect parts without CanCollide. If you want them to detect those parts, consider this article:
Idk but you can use the TouchEnded on the big part and run the GetTouchingParts again to see which Model is not in the part.
This reply has been marked has a solution, but I’d like to explain how I kinda solved this topic.
GetTouchingParts function ran by a bigger part does work counting things but it only counts parts and not models. So I suggested finding its ancestor to get the Model and compare each part to see which Model they belong to. If one part has the same model as the other, ok then. The part will be detected as a duplicate and would not be counted.
Additionally, he asked how he would figure out which model is no longer in the part; the answer is already at the top.