Log in to vote

Raycasting dosent work to me as it should?

Asked by 8 days ago

I am trying to make a laser beam that would turn off if something is blocking it, but what ever i do it dosent work.

local origin = script.Parent.Position local direction = workspace.HUB local params = local result = workspace:Raycast(origin, direction) if result then local distance = (origin - result.Position).Magnitude local p ="Part") p.Anchored = true p.CanCollide = false p.Size =, 0.1, distance) p.CFrame = CFrame.lookAt(origin)*, 0, -distance/2) end

thanks for helping me.

Answer this question