How could I make an actual laser gun?

So, I want to have a secondary in my game where you equip a laser hand, and when you hold down E, it will fire out a continuous laser that when hit, will damage the enemy. How could I do this?

I thought of using FastCast or just normal raycasts, raycasts could technically work, but when you would use it on the sky, it always returns nil. Any ideas?

Also can’t use the FE gun kit here since you will always have the weapon equipped, and you can’t have two weapons at once.

1 Like

If you click on the sky you should instead “aim” the laser at a point that follows the mouse ray for some long distance, this will simulate actually clicking something infinitely far away.

For the Hold E part, (Assuming you will use a Tool) you can do this:

local Firerate = .1
local IsShooting = false

Tool.Activated:Connect(function()
IsShooting = true
end)

Tool.Unequipped:Connect(function()
IsShooting = false -- this is so it doesn't keep firing when unequipped
end)

while task.wait(Firerate) do
if IsShooting == true then
print("Shooting")
else
IsShooting = false -- This is unnessacary
end
end

@GibusWielder About the Laser part, Do you want it as a Projectile or a Trail?

As described in the post, I want it as a beam. Also, it won’t be a tool, and I know how to script that part. I need help with the beam part, as I’m not sure how to do the hit detection.

I’ll try that. Thank you.