local U={shock=1;bolt=1,bullet=1;plasma=1,effect=1;laser=1;handle=1;effects=1,flash=1}function CheckIntangible(N)print(N.Name)return U[string.lower(N.Name)]or N.Transparency==1 end function CastRay(U,N,u,M,G)if u>999 then u=999 end hit,endpos2=game.Workspace:FindPartOnRay(Ray.new(U,N*u),M)if hit~=nil then if CheckIntangible(hit)then if G then wait()end hit,endpos2=CastRay(endpos2+N*.01,N,u-(U-endpos2).magnitude,M,G)end end return hit,endpos2 end function DrawBeam(U,N,u,M,G)local t=2 local L=G:Clone()L.BrickColor=u L.Size=Vector3.new(.1,.1,t+.2)L.CFrame=CFrame.new((N+U)/2,U)*CFrame.new(0,0,-t/2)L.Parent=game.Workspace game.Debris:AddItem(L,M)end

local Intangibles = {shock=1, bolt=1, bullet=1, plasma=1, effect=1, laser=1, handle=1, effects=1, flash=1,}
function CheckIntangible(hitObj)
	print(hitObj.Name)
	return Intangibles[(string.lower(hitObj.Name))] or hitObj.Transparency == 1
end

function CastRay(startpos, vec, length, ignore, delayifhit)
	if length > 999 then
		length = 999
	end
	hit, endpos2 = game.Workspace:FindPartOnRay(Ray.new(startpos, vec * length), ignore)
	if hit ~= nil then
		if CheckIntangible(hit) then
			if delayifhit then
				wait()
			end
			hit, endpos2 = CastRay(endpos2 + (vec * .01), vec, length - ((startpos - endpos2).magnitude), ignore, delayifhit)
		end
	end
	return hit, endpos2
end

function DrawBeam(beamstart, beamend, clr, fadedelay, templatePart)
	local dis = 2 --(beamstart - beamend).magnitude
	local tlaser=templatePart:Clone()
	tlaser.BrickColor = clr
	tlaser.Size = Vector3.new(.1, .1, dis + .2)
	tlaser.CFrame = CFrame.new((beamend+beamstart)/2, beamstart) * CFrame.new(0, 0, - dis/2)
	tlaser.Parent = game.Workspace
	game.Debris:AddItem(tlaser, fadedelay)
end
