local D={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 D[string.lower(n.Name)]or n.Transparency==1 end function CastRay(D,n,b,M,m)if b>999 then b=999 end hit,endpos2=game.Workspace:FindPartOnRay(Ray.new(D,n*b),M)if hit~=nil then if CheckIntangible(hit)then if m then wait()end hit,endpos2=CastRay(endpos2+n*.01,n,b-(D-endpos2).magnitude,M,m)end end return hit,endpos2 end function DrawBeam(D,n,b,M,m)local i=2 local s=m:Clone()s.BrickColor=b s.Size=Vector3.new(.12,.12,i+.2)s.CFrame=CFrame.new((n+D)/2,D)*CFrame.new(0,0,-i/2)s.Parent=game.Workspace game.Debris:AddItem(s,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(.12, .12, 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
