local g=os.clock function DiscretePulse(g,n,D,t,C,w,o)return math.clamp(D/(2*t)-math.abs(((g-C*n)+.5*D)/t),w,o)end function NoiseBetween(g,n,D,t,C)return t+(C-t)*(math.noise(g,n,D)+.5)end function CubicBezier(g,n,D,t,C)return((g*(1-C)^3+((n*3)*C)*(1-C)^2)+((D*3)*(1-C))*C^2)+t*C^3 end local n=Instance.new("\080\097\114\116")n.TopSurface,n.BottomSurface=0,0 n.Anchored,n.CanCollide=true,false n.Shape="\067\121\108\105\110\100\101\114"n.Name="\066\111\108\116\080\097\114\116"n.Material=Enum.Material.Neon n.Color=Color3.new(1,1,1)n.Transparency=1 local D=Random.new()local t=(CFrame.lookAt(Vector3.new(),Vector3.new(1,0,0))):inverse()local C={}local w={}w.__index=w


local clock = os.clock






function DiscretePulse(input, s, k, f, t, min, max) --input should be between 0 and 1. See https://www.desmos.com/calculator/hg5h4fpfim for demonstration.
	return math.clamp( (k)/(2*f) - math.abs( (input - t*s + 0.5*(k)) / (f) ), min, max )
end

function NoiseBetween(x, y, z, min, max)
	return min + (max - min)*(math.noise(x, y, z) + 0.5)
end

function CubicBezier(p0, p1, p2, p3, t)
	return p0*(1 - t)^3 + p1*3*t*(1 - t)^2 + p2*3*(1 - t)*t^2 + p3*t^3
end

local BoltPart = Instance.new("Part")
BoltPart.TopSurface, BoltPart.BottomSurface = 0, 0
BoltPart.Anchored, BoltPart.CanCollide = true, false
BoltPart.Shape = "Cylinder"
BoltPart.Name = "BoltPart"
BoltPart.Material = Enum.Material.Neon
BoltPart.Color = Color3.new(1, 1, 1)
BoltPart.Transparency = 1

local rng = Random.new()
local xInverse = CFrame.lookAt(Vector3.new(), Vector3.new(1, 0, 0)):inverse()

local ActiveBranches = {}

local LightningBolt = {}
LightningBolt.__index = LightningBolt
