--// Beam flag wavy thing
--// Written by Informable/Autumn
--// Do not distribute without this header


local beam = script.Parent.Beam
local p1 = script.Parent.End
local p2 = script.Parent.Start
local cf1 = p1.CFrame
local cf2 = p2.CFrame
local cos = 0
local noise = 0
local noise2 = 0

math.randomseed(tick())
local seed1 = math.random()*3+2
local seed2 = math.random()*3+2
local seed3 = math.random()*3+2

game:GetService("RunService").Stepped:connect(function()
	cos = cos + .05
	noise = noise + .1
	noise2 = noise2 + .2
	local noiser1 = math.noise(seed1,noise/35,noise/35)*3
	local noiser2 = math.noise(seed2*3+2,noise2/42,noise2/42)*3
	local noiser3 =math.noise(seed3*3+2,noise2/27,noise2/27)*3
	p1.CFrame = cf1*CFrame.new(noiser1,0,0)*CFrame.Angles(0,math.cos(cos/2)*noiser3/3.5-1.5,0)
	p2.CFrame = cf2*CFrame.Angles(0,math.sin(cos/3.5)/2+noiser2/3.5-1.5,0)
end)
