local H={}H.__index=H local e={}function H.new(d,s)local m=setmetatable({},H)m.Enabled=true m.LightningBolt=d m.MaxSparkCount=s or 10 m.MinSpeed=4 m.MaxSpeed=6 m.MinDistance=3 m.MaxDistance=6 m.MinPartsPerSpark=8 m.MaxPartsPerSpark=10 m.SparksN=0 m.SlotTable={}m.RefIndex=#e+1 e[m.RefIndex]=m return m end function H.Destroy(H)e[H.RefIndex]=nil for e,d in pairs(H.SlotTable)do if d.Parts[1].Parent==nil then H.SlotTable[e]=nil end end H=nil end local d=Random.new()function RandomVectorOffset(H,e)return((CFrame.lookAt(Vector3.new(),H)*CFrame.Angles(0,0,d:NextNumber(0,2*math.pi)))*CFrame.Angles(math.acos(d:NextNumber(math.cos(e),1)),0,0)).LookVector end local s=require(script.Parent);(game:GetService("\082\117\110\083\101\114\118\105\099\101")).Heartbeat:Connect(function()local H,m,c=pairs(e)while true do local e,B=H(m,c)if not e then break end if B.Enabled==true and B.SparksN<B.MaxSparkCount then local H=B.LightningBolt if H.Parts[1].Parent==nil then B:Destroy()return end local e=H.Parts local m=#e local c={}for H=1,#e,1 do if e[H].Transparency<.3 then c[#c+1]=(H-.5)/m end end local o=nil local w=nil if#c~=0 then o=math.ceil(c[1]*B.MaxSparkCount)w=math.ceil(c[#c]*B.MaxSparkCount)end for H=1,d:NextInteger(1,B.MaxSparkCount-B.SparksN),1 do if#c==0 then break end local X={}for H=o,w,1 do if B.SlotTable[H]==nil then X[#X+1]=H end end if#X~=0 then local H=X[d:NextInteger(1,#X)]local o=d:NextNumber(-0.5,.5)local w=((H-.5)+o)/B.MaxSparkCount local M=10 local D=1 for H=1,#c,1 do local e=math.abs(c[H]-w)if e<M then M=e D=math.floor((c[H]*m+.5)+.5)end end local J=e[D]local h={}local I={}h.WorldPosition=J.Position+(o*J.CFrame.RightVector)*J.Size.X I.WorldPosition=h.WorldPosition+RandomVectorOffset(J.CFrame.RightVector,math.pi/4)*d:NextNumber(B.MinDistance,B.MaxDistance)h.WorldAxis=(I.WorldPosition-h.WorldPosition).Unit I.WorldAxis=h.WorldAxis local L=s.new(h,I,d:NextInteger(B.MinPartsPerSpark,B.MaxPartsPerSpark))L.MinRadius=0 L.MaxRadius=.8 L.AnimationSpeed=0 L.Thickness=J.Size.Y/2 L.MinThicknessMultiplier=1 L.MaxThicknessMultiplier=1 L.PulseLength=.5 L.PulseSpeed=d:NextNumber(B.MinSpeed,B.MaxSpeed)L.FadeLength=.25 local O,S,n=Color3.toHSV(J.Color)L.Color=Color3.fromHSV(O,.5,n)B.SlotTable[H]=L end end end local o=0 for H,e in pairs(B.SlotTable)do if e.Parts[1].Parent~=nil then o=o+1 else B.SlotTable[H]=nil end end B.SparksN=o end end)return H
-- Decompiled with the Synapse X Luau decompiler.

local v1 = {}
v1.__index = v1
local u1 = {}
function v1.new(p1, p2)
	local v2 = setmetatable({}, v1)
	v2.Enabled = true
	v2.LightningBolt = p1
	v2.MaxSparkCount = p2 or 10
	v2.MinSpeed = 4
	v2.MaxSpeed = 6
	v2.MinDistance = 3
	v2.MaxDistance = 6
	v2.MinPartsPerSpark = 8
	v2.MaxPartsPerSpark = 10
	v2.SparksN = 0
	v2.SlotTable = {}
	v2.RefIndex = #u1 + 1
	u1[v2.RefIndex] = v2
	return v2
end
function v1.Destroy(p3)
	u1[p3.RefIndex] = nil
	for v3, v4 in pairs(p3.SlotTable) do
		if v4.Parts[1].Parent == nil then
			p3.SlotTable[v3] = nil
		end
	end
	p3 = nil
end
local u2 = Random.new()
function RandomVectorOffset(p4, p5)
	return (CFrame.lookAt(Vector3.new(), p4) * CFrame.Angles(0, 0, u2:NextNumber(0, 2 * math.pi)) * CFrame.Angles(
		math.acos(u2:NextNumber(math.cos(p5), 1)),
		0,
		0
	)).LookVector
end
local u3 = require(script.Parent)
game:GetService("RunService").Heartbeat:Connect(function()
	local v5, v6, v7 = pairs(u1)
	while true do
		local v8, v9 = v5(v6, v7)
		if not v8 then
			break
		end
		if v9.Enabled == true and v9.SparksN < v9.MaxSparkCount then
			local l__LightningBolt__10 = v9.LightningBolt
			if l__LightningBolt__10.Parts[1].Parent == nil then
				v9:Destroy()
				return
			end
			local l__Parts__11 = l__LightningBolt__10.Parts
			local v12 = #l__Parts__11
			local v13 = {}
			for v14 = 1, #l__Parts__11 do
				if l__Parts__11[v14].Transparency < 0.3 then
					v13[#v13 + 1] = (v14 - 0.5) / v12
				end
			end
			local v15 = nil
			local v16 = nil
			if #v13 ~= 0 then
				v15 = math.ceil(v13[1] * v9.MaxSparkCount)
				v16 = math.ceil(v13[#v13] * v9.MaxSparkCount)
			end
			for v17 = 1, u2:NextInteger(1, v9.MaxSparkCount - v9.SparksN) do
				if #v13 == 0 then
					break
				end
				local v18 = {}
				for v19 = v15, v16 do
					if v9.SlotTable[v19] == nil then
						v18[#v18 + 1] = v19
					end
				end
				if #v18 ~= 0 then
					local v20 = v18[u2:NextInteger(1, #v18)]
					local v21 = u2:NextNumber(-0.5, 0.5)
					local v22 = (v20 - 0.5 + v21) / v9.MaxSparkCount
					local v23 = 10
					local v24 = 1
					for v25 = 1, #v13 do
						local v26 = math.abs(v13[v25] - v22)
						if v26 < v23 then
							v23 = v26
							v24 = math.floor(v13[v25] * v12 + 0.5 + 0.5)
						end
					end
					local v27 = l__Parts__11[v24]
					local v28 = {}
					local v29 = {}
					v28.WorldPosition = v27.Position + v21 * v27.CFrame.RightVector * v27.Size.X
					v29.WorldPosition = v28.WorldPosition
						+ RandomVectorOffset(v27.CFrame.RightVector, math.pi / 4)
							* u2:NextNumber(v9.MinDistance, v9.MaxDistance)
					v28.WorldAxis = (v29.WorldPosition - v28.WorldPosition).Unit
					v29.WorldAxis = v28.WorldAxis
					local v30 = u3.new(v28, v29, u2:NextInteger(v9.MinPartsPerSpark, v9.MaxPartsPerSpark))
					v30.MinRadius = 0
					v30.MaxRadius = 0.8
					v30.AnimationSpeed = 0
					v30.Thickness = v27.Size.Y / 2
					v30.MinThicknessMultiplier = 1
					v30.MaxThicknessMultiplier = 1
					v30.PulseLength = 0.5
					v30.PulseSpeed = u2:NextNumber(v9.MinSpeed, v9.MaxSpeed)
					v30.FadeLength = 0.25
					local v31, v32, v33 = Color3.toHSV(v27.Color)
					v30.Color = Color3.fromHSV(v31, 0.5, v33)
					v9.SlotTable[v20] = v30
				end
			end
		end
		local v34 = 0
		for v35, v36 in pairs(v9.SlotTable) do
			if v36.Parts[1].Parent ~= nil then
				v34 = v34 + 1
			else
				v9.SlotTable[v35] = nil
			end
		end
		v9.SparksN = v34
	end
end)
return v1
