Hi guys, I am trying to make a laser pointer/laser sight, but even with the raycasts, the laser goes through walls because the End attachment does not update for some reason, or going to the position: 0,0,0 (it’s default position) when rotated at certain angles, and I cannot figure out as to why (I am using a beam for my laser), here’s my script:
local param = RaycastParams.new()
local att1 = script.Parent.Start
local att2 = script.Parent.End
while true do
wait()
local ray = game.Workspace:Raycast(script.Parent.Position, att2.CFrame.LookVector*15000, param)
if ray then
att2.Position = ray.Position - script.Parent.Position
else
att2.Position = att2.CFrame.LookVector*15000
end
end