So basically i already made a solution for that with the problem being.. It's REALLY laggy.
And i kind of understand why it does that but it's the only solution i know of.
Example of what i'm using:
1 | for _,v in pairs (workspace:GetChildren()) do |
2 | if v:IsA( "BasePart" ) then |
3 | if (v.Position - MyPart.Position + Vector 3. new( 0 , 2 , 0 )).Magnitude < 5 then |
4 | myfunction() |
5 | end |
6 | end |
7 | end |
now it does work but like i said it's very laggy!
I've been thinking about using rays but i'm new to them since i never bothered trying them out in any of my scripts but i think they can stop at certain points when they hit a part if you use the right script.
Any ideas on how i could fix this?
Constantly fire a ray that shoots above the parts position.
local newray = Ray.new(MyPart.Position, MyPart.Position + Vector3.new(0,999,0) local Hit,Position = workspace:FindPartOnRay(newray) print(Hit) you can use FindPartOnRayWithIgnoreList to filter out what you want it to hit.