Using the same coordinates resulting in different places

Hey so I’m making a laser gun and the functional part of the gun is working, but I’m trying to make an effect for the gun, and even though I’m using the same coordinates for the effect as I am with the gun, it’s going in a totally different place that I don’t understand the relation for.
This is the functional part:

local direction = (mouse.Hit.p - tool.Tip.Position).Unit
local ray1 = workspace:Raycast(tool.Tip.Position,direction*100)

Remember the direction times 100. In a later part of the script, I send the direction over a RemoteEvent.

--Local script
laserEvent:FireServer(w1,w2,w3,direction)

--Server script
a1Part.Position = direction*100

The resulting position of the part is way over at the red house. I’m really stuck on this, anybody know why? Sorry, it’s sort of hard to see in the video.


I’m also attaching the whole server and local script if there are details I failed to include.
LaserServer.txt (1.6 KB) LaserLocal.txt (1.8 KB)
Thank you in advance!

1 Like

The direction describes the difference between two points in space, this direction could be thought to have no position

As a result of this, using it to position the a1part could be problematic because it doesnt really describe anything useful to the global space position of a1part

It would be proper to send just the mouse position and do

a1part.Position = mousepos

If you wanted to make it 100 studs away all the time, you would have to do something along the lines of:

a1part.Position = tool.Tip.Position + (direction * 100)

Which you might want to do

2 Likes