How would I fix part spawning at mouse to continue rising?

I was trying to make a laser script that can follow the mouse. I used raycast for it. I have no problems with it beside the finish part for the ray (the one that follows the mouse). It keeps on rising until it reaches the top of the camera then resets. A video is right here.

heres the script for it too

while true do
				f.CFrame = CFrame.new(mouse.Hit.Position.X,mouse.Hit.Position.Y,mouse.Hit.Position.Z)
end

thanks in advance!

You forgot to blacklist the part itself from Mouse.Hit

Also you should be using Raycasts instead since that allows you to more finely tune the collision filter

1 Like