function CastLightRay(b,y,V,S,X,U,G)local L,D=game.Workspace:FindPartOnRay(Ray.new(b,(y-b).unit*999.999),Tool.Parent)if D then y=D end if L and L.Parent then if L.Parent:FindFirstChild("\072\117\109\097\110\111\105\100")and L.Parent~=Tool.Parent then G(L.Parent.Humanoid,(y-b).unit)elseif L.Parent.Parent and(L.Parent.Parent:FindFirstChild("\072\117\109\097\110\111\105\100")and L.Parent.Parent~=Tool.Parent)then G(L.Parent.Parent.Humanoid,(y-b).unit)end end local g=math.floor(math.min((b-y).magnitude/S,50))local F=#U for b=g,F,1 do if U[b]then U[b]:Destroy()U[b]=nil end end for X=1,g,1 do if not U[X]then U[X]=Instance.new("\080\097\114\116")U[X].Parent=Tool U[X].Anchored=true U[X].FormFactor="\067\117\115\116\111\109"U[X].Size=Vector3.new(0,0,S)U[X].CanCollide=false local b=Instance.new("\080\111\105\110\116\076\105\103\104\116")b.Name="\076\105\103\104\116"b.Parent=U[X]end U[X].BrickColor=V;(U[X]:WaitForChild("\076\105\103\104\116")).Color=V.Color U[X].Light.Range=(math.sin(tick()*3)+1)*1+5 U[X].Light.Brightness=(math.sin(tick()*3)+1)*1+1 U[X].CFrame=CFrame.new(((X-.4)*(y-b).unit)*S+b,y)end return U end
--[[Script Functions]]
--

function CastLightRay(startPos, endPos, color, segLength, segSpeed, parts, effectfunc)
	local part, nend = game.Workspace:FindPartOnRay(Ray.new(startPos, (endPos - startPos).unit * 999.999), Tool.Parent)
	if nend then
		endPos = nend
	end

	if part and part.Parent then
		if part.Parent:FindFirstChild("Humanoid") and part.Parent ~= Tool.Parent then
			effectfunc(part.Parent.Humanoid, (endPos - startPos).unit)
		elseif
			part.Parent.Parent
			and part.Parent.Parent:FindFirstChild("Humanoid")
			and part.Parent.Parent ~= Tool.Parent
		then
			effectfunc(part.Parent.Parent.Humanoid, (endPos - startPos).unit)
		end
	end

	local numSegments = math.floor(math.min((startPos - endPos).magnitude / segLength, 50))
	local initNumParts = #parts
	for i = numSegments, initNumParts, 1 do
		if parts[i] then
			parts[i]:Destroy()
			parts[i] = nil
		end
	end
	for i = 1, numSegments, 1 do
		if not parts[i] then
			parts[i] = Instance.new("Part")
			parts[i].Parent = Tool
			parts[i].Anchored = true
			parts[i].FormFactor = "Custom"
			parts[i].Size = Vector3.new(0, 0, segLength)
			parts[i].CanCollide = false
			local tlight = Instance.new("PointLight")
			tlight.Name = "Light"
			tlight.Parent = parts[i]
		end
		parts[i].BrickColor = color
		parts[i]:WaitForChild("Light").Color = color.Color
		parts[i].Light.Range = ((math.sin(tick() * 3) + 1) * 1) + 5
		parts[i].Light.Brightness = ((math.sin(tick() * 3) + 1) * 1) + 1

		parts[i].CFrame = CFrame.new(((i - 0.4) * (endPos - startPos).unit * segLength) + startPos, endPos)
	end

	return parts
end
