Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Looking to find another way of checking if Part/Model is Near?

I was looking for a way to check if a Part is near any model in the workspace and each model has StringValue that Name was Type and possible values is Rock, Grass, Ice. I tried to wrap my head around this thinking this through i thought i might use Magnitude but.. i wanted to do differently that makes it easier in a way that i won't have to collect all the models for example using for loops and has the StringValue in it and check what type it is.. is there any possible way?

6 comments

0

Magnitude is actually the easiest way to do this. If you try to do it any other way, you're basically reinventing the wheel.

0

Unless you really want to make your own system, magnitude is the best thing for you to use.

0

If you want all parts that are near model, consider FindPartsInRegion3 function. You can also use FindPartsInRegion3WithWhitelist or FindPartsInRegion3WithIngoreList, if you know what you are looking for. Magnitude would be the best if there are not many parts to iterate through, and calculate magnitude for each one.

0

Still reinventing the wheel, and Region3's are more difficult to work with than magnitude

0

You can use Part.Touched:Connect(function(hit) and then check if the hit's name was the other part you wanted to be near

0

You can make that part invisible so players cannot see it and set its cancollide to false so players cannot collide with it.

1 answer

✓ Accepted answer

Use magnitude for this as it would work best

This discussion is preserved as it was. New answers, comments, and votes are closed.