--// Functions
function TurnOff()
	L_27_ = false
	L_25_ = false
	L_14_ = false
	L_40_:FireServer()
end

function CheckForHumanoid(L_47_arg1)
	local L_48_ = false
	local L_49_ = nil
	if L_47_arg1 then
		if (L_47_arg1.Parent:FindFirstChild("Humanoid") or L_47_arg1.Parent.Parent:FindFirstChild("Humanoid")) then
			L_48_ = true
			if L_47_arg1.Parent:FindFirstChild('Humanoid') then
				L_49_ = L_47_arg1.Parent.Humanoid
			elseif L_47_arg1.Parent.Parent:FindFirstChild('Humanoid') then
				L_49_ = L_47_arg1.Parent.Parent.Humanoid
			end
		else
			L_48_ = false
		end	
	end
	return L_48_, L_49_
end

function Fire(L_50_arg1)
	for L_61_forvar1, L_62_forvar2 in pairs(L_50_arg1:GetChildren()) do
		if L_62_forvar2.Name:sub(1, 7) == 'FlashFX' then
			L_62_forvar2.Enabled = true
		end
	end
	
	delay(1 / 30, function()
		for L_63_forvar1, L_64_forvar2 in pairs(L_50_arg1:GetChildren()) do
			if L_64_forvar2.Name:sub(1, 7) == 'FlashFX' then
				L_64_forvar2.Enabled = false
			end
		end
	end)

	local L_51_ = L_50_arg1.Position
	local L_52_ = L_50_arg1.CFrame.lookVector.unit
	local L_53_ = CFrame.new(L_51_, L_51_ + L_52_)
	
	local L_54_ = Instance.new("Part")
	L_54_.Parent = L_38_
	game.Debris:AddItem(L_54_, 3)
	L_54_.Shape = Enum.PartType.Block
	L_54_.Size = L_7_.BulletSize
	L_54_.Name = "Bullet"
	L_54_.TopSurface = "Smooth"
	L_54_.BottomSurface = "Smooth"
	L_54_.BrickColor = BrickColor.new("Bright green")
	L_54_.Material = "Neon"
	L_54_.CanCollide = false
	L_54_.CFrame = L_50_arg1.CFrame + (L_50_arg1.CFrame.p - L_50_arg1.CFrame.p)
	L_54_.CFrame = CFrame.new(L_50_arg1.CFrame.p, L_50_arg1.CFrame.p + L_52_)
	
	local L_55_ = Instance.new('BodyVelocity', L_54_)
	L_55_.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
	L_55_.P = 10

	L_55_.Velocity = L_52_ * L_7_.BulletSpeed
	
	local L_56_, L_57_, L_58_ = workspace:FindPartOnRayWithIgnoreList(Ray.new(L_50_arg1.Position, L_50_arg1.CFrame.lookVector * L_7_.CastDist), L_39_);
	local L_59_ = Vector3.new(0, 1, 0):Cross(L_58_)
	local L_60_ = math.asin(L_59_.magnitude)
	
	if L_56_ and (L_56_ and L_56_.Transparency >= 1 or L_56_.CanCollide == false) and L_56_.Name ~= 'Right Arm' and L_56_.Name ~= 'Left Arm' and L_56_.Name ~= 'Right Leg' and L_56_.Name ~= 'Left Leg' and L_56_.Name ~= 'Armor' then
		table.insert(L_39_, L_56_)
	end
	
	if L_56_ then
		L_59_ = Vector3.new(0, 1, 0):Cross(L_58_)
		L_60_ = math.asin(L_59_.magnitude) -- division by 1 is redundant
		
		L_43_:FireServer(L_57_)
		
		local L_65_, L_66_ = CheckForHumanoid(L_56_)
		if L_65_ == false then
			local L_67_ = L_44_:InvokeServer(L_57_, L_59_, L_60_, L_58_, "Part", L_56_, 'NonExplosive')
		elseif L_65_ == true then
			local L_68_ = L_44_:InvokeServer(L_57_, L_59_, L_60_, L_58_, "Human", L_56_, 'NonExplosive')
			L_46_:FireServer(L_66_)
			L_45_:FireServer(L_66_, L_7_.BulletDamage)
		end
	end
end

function FireATG(L_69_arg1)
	if L_18_ > 0 then
		L_18_ = L_18_ - 1
		if L_18_ < 0 then
			L_18_ = 0
		end
		
		L_37_.Text = 'ATGs: ' .. L_18_
		
		for L_84_forvar1, L_85_forvar2 in pairs(L_69_arg1:GetChildren()) do
			if L_85_forvar2.Name:sub(1, 7) == 'FlashFX' then
				L_85_forvar2.Enabled = true
			end
		end
		
		delay(1 / 30, function()
			for L_86_forvar1, L_87_forvar2 in pairs(L_69_arg1:GetChildren()) do
				if L_87_forvar2.Name:sub(1, 7) == 'FlashFX' then
					L_87_forvar2.Enabled = false
				end
			end
		end)
	
		local L_70_ = L_69_arg1.Position
		local L_71_ = L_69_arg1.CFrame.lookVector.unit
		local L_72_ = CFrame.new(L_70_, L_70_ + L_71_)
		
		local L_73_ = Instance.new("Part")
		L_73_.Parent = L_38_
		game.Debris:AddItem(L_73_, 10)
		L_73_.Shape = Enum.PartType.Block
		L_73_.Size = L_7_.BulletSize
		L_73_.Name = "Bullet"
		L_73_.TopSurface = "Smooth"
		L_73_.BottomSurface = "Smooth"
		L_73_.BrickColor = BrickColor.new("Bright green")
		L_73_.Material = "Neon"
		L_73_.CanCollide = false
		L_73_.CFrame = L_69_arg1.CFrame + (L_69_arg1.CFrame.p - L_69_arg1.CFrame.p)
		L_73_.CFrame = CFrame.new(L_69_arg1.CFrame.p, L_69_arg1.CFrame.p + L_71_)
		local L_74_ = L_4_:WaitForChild('FX'):WaitForChild('RocketTrail'):clone()
		L_74_.Parent = L_73_
		L_74_.Enabled = true
		
		local L_75_ = Instance.new('BodyVelocity', L_73_)
		L_75_.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
		L_75_.P = 10
	
		L_75_.Velocity = L_71_ * L_7_.BulletSpeed
		
		local L_76_ = L_69_arg1.Position;
		local L_77_ = L_73_.Position;
		local L_78_ = 0
		local L_79_, L_80_, L_81_
		local L_82_
		local L_83_
		
		while true do
			L_9_:wait()
			L_77_ = L_73_.Position;
			L_78_ = L_78_ + (L_77_ - L_76_).magnitude
			L_79_, L_80_, L_81_ = workspace:FindPartOnRayWithIgnoreList(Ray.new(L_76_, (L_77_ - L_76_)), L_39_);
			L_82_ = Vector3.new(0, 1, 0):Cross(L_81_)
			L_83_ = math.asin(L_82_.magnitude) -- division by 1 is redundant
			
			--[[if distance >= config.CastDist then
				Bullet:Destroy()
				break
			end]]--
			
			if L_79_ and (L_79_ and L_79_.Transparency >= 1 or L_79_.CanCollide == false) and L_79_.Name ~= 'Right Arm' and L_79_.Name ~= 'Left Arm' and L_79_.Name ~= 'Right Leg' and L_79_.Name ~= 'Left Leg' and L_79_.Name ~= 'Armor' then
				table.insert(L_39_, L_79_)
			end
			
			if L_79_ then
				L_82_ = Vector3.new(0, 1, 0):Cross(L_81_)
				L_83_ = math.asin(L_82_.magnitude) -- division by 1 is redundant
				
				L_43_:FireServer(L_80_)
				local L_88_ = L_44_:InvokeServer(L_80_, L_82_, L_83_, L_81_, "Part", L_79_, 'Explosive')
				L_73_:Destroy()
				break
			end
		end
	end
end