Hello, im new to raycasting and im trying to make a lazer that goes straight and shoots every 7 seconds
So i have this raycasting script from a wiki post [https://www.robloxdev.com/articles/Making-a-ray-casting-laser-gun-in-Roblox] but mouse
position
and toolHandle
are not defined since i want the ray to go straight. Any ideas?
local Lazer = script.Parent local ray = Ray.new(Lazer.CFrame.p, (mouse.Hit.p - toolHandle.CFrame.p).unit * 300) local beam = Instance.new("Part", workspace) local distance = (Lazer.CFrame.p - position).magnitude beam.Size = Vector3.new(0.3, 0.3, distance) beam.CFrame = CFrame.new(Lazer.CFrame.p, position) * CFrame.new(0, 0, -distance / 2)