Why doesn't this ray start at the attachments position?

I made a script for ray detection, but for some reason the attachment I added isn’t positioning right with the ray. Here’s code:

local ray = Ray.new(Att1.Position, Vector3.new(0,5,0))

Any errors? or can you screen shot of the whole screen?

There’s no output errors, I think I’m just doing the ray wrong and it’s supposed to work for the attachment so i’m not really sure what to do.

Can you show me your attachment?

These are all the attachments, I’ve only tested 1 so far which doesn’t seem to work.
image

They’re all inside of the blade, i’m guessing the position of them is always gonna be 0,0,0 so that’s probably why i’m not detecting anything. How do I get the exact position of the attachment?

I figured out a way to fix this, just get the WorldPosition of the attachment.

1 Like

your syntax is incorrect.

Ray.new has 2 paramaters,

first is the origin of the ray, in this case Att1.Position

second is the direction of the ray, which requires 2 points to define, in order to make a line, you however, only wrote 1 of them

the correct syntax would be

Ray.new(Att1.WorldPosition, ((Att1.WorldPosition + Vector3.new(0,5,0)) - Att1.WorldPosition)