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

How would I determine if there is a part nearby?[SOLVED BY MYSELF]

I am making a game where you can ride a horse, and if the horse gets too close to a part, it dodges out of the way. I am currently stuck on how I could determine if there is a part nearby. Please help!

5 comments

1

Best bet is to use raycasting to and have multiple rays shoot out from the front of the horse in multiple directions in front..

0

Sounds awesome ^

0

Hmm... okay

0

I don't know how to use raycasting >_<

0

Just searched it up on the wiki and am confused

1 answer

local magnitude = (part1.Position - part2.Position).magnitude
print(magnitude)
--Change the parts to whatever fits your needs.

Directly from wiki.

1 comment

0

I guess I could use magnitude, but then I would have to test for every block in the game :/

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