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

[SOLVED] How do I detect parts around me with Lua?

I previously asked this question only to be rudely downvoted by a person who misunderstood and thought I was requesting a script to be made.

This: http://www.roblox.com/games/146363401/Dynamic-Parkour-Demo-Updated

I'd love to create one of my own.

I already have lots of scripting knowledge.

Any idea how to detect parts around me?

6 comments

0

if you have scripting knowledge then make the script..... I told you before we aren't gonna make it for you. You have to make a decent attempt and then it there are bugs then we help FIX. Keyword FIX. This site does NOT make scripts for you

0

...Oh god not you again. Why isn't it clear? I DO NOT want anyone to make it for me. I want to know HOW to make it. Be more helpful, please. Suggest something.

3

"Any idea how" <- That is not a request. I feel downvotes are a bit too strict for this question. He's asking for a general concept

0

Thank you for understanding Digital! :D

0

This can be accomplished by using 'magnitude' (to me, at least). :) WIKI Document on Magnitude: http://wiki.roblox.com/index.php?title=Magnitude

0

I would look into Region3

2 answers

There is the parameter "otherPart" you can use. It will return the parts touching the part the script is in.

Maybe duplicate a script like this into the player's limbs.

Like you asked, just a general idea!

from what I understood, you wanted a list of parts near you, now there are two ways we could go about this, we could iterate through all the parts in the Workspace and child models, and use magnitude to detect if they're close, or we could define a Region3 wiki link around the player, but the region's position will need to update a few times per second to keep up with the player, especially in a parkour game, but it should still be a lot more efficient than iterating through all the parts everywhere, then use this function (FindPartsInRegion3) to get all the parts.

no matter what you do, there's not a really efficient method, but Region3s seem to be the most efficient, also, a message to any master scripter that might read this; if there is a more a efficient method, I'd like to know.

2 comments

1

You could cast a ray, but It wouldn't be as accurate as a region3, although it would allow for easier handling and might be more specific, depending on the situation.

0

^With raycasting you could definitely obtain information about where parts are relative to the player easily. But yes, Region3 is probably the most effective and efficient method for this.

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