System: You will be given a Luau script (that has been decompiled). You will rename the variables and functions to sound better, make the script more coherent, and add comments to areas of the script. Return the fixed script without adding ``` as we handle that. If no script has been given, do not produce any output. Do not respond with anything but the script
User: -- Decompiler will be improved soon!
-- Decompiled with Konstant V2.1, a fast Luau decompiler made in Luau by plusgiant5 (https://discord.gg/wyButjTMhM)
-- Decompiled on 2025-02-07 13:37:45
-- Luau version 6, Types version 3
-- Time taken: 0.024136 seconds

local Assets_upvr = game:GetService("ReplicatedStorage").Assets
local Modules = game:GetService("ReplicatedStorage").Modules
local Shared_upvr = require(Modules.Core.Shared)
local Matchmaking_upvr = require(Modules.Core.Matchmaking)
task.spawn(function() -- Line 18
	--[[ Upvalues[1]:
		[1]: Assets_upvr (readonly)
	]]
	task.wait(0.33)
	if Assets_upvr.Session.Biome.Value == "Hero" then
		for _, v in pairs(game.Workspace.Decoration:GetChildren()) do
			if v:IsA("BasePart") and v.Name == "Barriers" then
				v.CanCollide = false
			end
		end
		script.Parent.Humanoid.Died:Once(function() -- Line 26
			for _, v_2 in pairs(game.Workspace.Decoration:GetChildren()) do
				if v_2:IsA("BasePart") and v_2.Name == "Barriers" then
					v_2.CanCollide = true
				end
			end
		end)
	end
end)
local module_upvr = {
	["Rocket Fired"] = false;
	["Rocket Time"] = 0.5;
	Rockets = 1;
	["Burst Interval"] = 0;
	["Minigun Active"] = false;
	P1 = {
		ID = 1177475221;
		Volume = 0.75;
		Pitch = 1;
	};
	P2 = {
		ID = 17603323426;
		Volume = 5;
		Pitch = 1;
	};
	Explode = {
		ID = 170278900;
		Volume = 1;
		Pitch = 1;
	};
	Phases = {
		Enabled = true;
		Level = 0;
		Segments = {{
			Min = 0.65;
			Max = 0.8;
		}, {
			Min = 0;
			Max = 0.65;
		}};
	};
	["Special Attacks"] = {
		Enabled = true;
		Rate = 5;
		Multiplier = 1;
		Used = false;
		Moveset = {{
			Name = "Rocket Flurry";
			Amount = 175;
			Rate = 0.04;
			Cooldown = 10;
			Damage = 60;
			StatueMult = 1.5;
			Velocity = 500;
			Range = 45;
			Particle = Assets_upvr.Gameplay.Particles:WaitForChild("RocketEXP");
			Explode = {
				ID = 4612378521;
				Volume = 0.25;
				Pitch = 1;
			};
			Launch = {
				ID = 5801273676;
				Volume = 0.375;
				Pitch = 1.5;
			};
			Pods = {CFrame.new(-0.5, 2.874, -4.637), CFrame.new(1, 2.874, -4.637), CFrame.new(1, 1.337, -4.637), CFrame.new(-0.5, 1.337, -4.637)};
		}, {
			Name = "Minigun Barrage";
			PrepTime = 1;
			Duration = 60;
			Cooldown = 6;
			StartUp = {
				ID = 2692844;
				Volume = 0.75;
				Pitch = 1;
			};
			End = {
				ID = 2692801;
				Volume = 0.75;
				Pitch = 1;
			};
		}};
	};
}
local var34_upvr = Matchmaking_upvr["Difficulty Nomenclature"][Assets_upvr.Session.Difficulty.Value]
local function UseSpecial_upvr(arg1, arg2, arg3, arg4, arg5, arg6) -- Line 115, Named "UseSpecial"
	--[[ Upvalues[5]:
		[1]: Assets_upvr (readonly)
		[2]: Shared_upvr (readonly)
		[3]: module_upvr (readonly)
		[4]: var34_upvr (readonly)
		[5]: Matchmaking_upvr (readonly)
	]]
	-- KONSTANTWARNING: Variable analysis failed. Output will have some incorrect variable assignments
	if not arg1 or not arg5 or not arg5.Parent or not arg2 or 0 >= arg2.Health then
	else
		if arg1.MinDifficulty and Assets_upvr.Session.Difficulty.Value < arg1.MinDifficulty then return end
		if arg1.Cue and arg1.Cue.ID then
			Shared_upvr.CreateSound(arg1.Cue, arg3)
		end
		if arg1.Name == "Minigun Barrage" then
			if 2 <= module_upvr.Phases.Level then return end
			delay(arg1.PrepTime, function() -- Line 127
				--[[ Upvalues[1]:
					[1]: module_upvr (copied, readonly)
				]]
				module_upvr["Minigun Active"] = true
			end)
			Shared_upvr.CreateSound(arg1.StartUp, arg3)
			wait(arg1.Duration)
			module_upvr["Minigun Active"] = false
			Shared_upvr.CreateSound(arg1.End, arg3)
		end
		local var102
		if arg1.Name == "Rocket Flurry" then
			local Handle_2 = arg5:WaitForChild("Shoulder Rocket Launcher").Handle
			if 4 > Assets_upvr.Session.Difficulty.Value then
				var102 = false
			else
				var102 = true
			end
			local RaycastParams_new_result1_2 = RaycastParams.new()
			RaycastParams_new_result1_2.FilterDescendantsInstances = {}
			RaycastParams_new_result1_2.FilterType = Enum.RaycastFilterType.Exclude
			if not var102 or not (arg1.Amount * 2) then
			end
			for _ = 1, arg1.Amount do
				local tbl_7 = {}
				RaycastParams_new_result1_2.FilterDescendantsInstances = Shared_upvr.CreateIgnoreList(arg5, false, true)
				for i_6, v_5 in pairs(workspace:GetChildren()) do
					if v_5:FindFirstChild("Humanoid") and v_5.Humanoid:GetState() ~= Enum.HumanoidStateType.Dead and not v_5:FindFirstChildOfClass("ForceField") and v_5 ~= arg5 then
						local Humanoid_6 = v_5:FindFirstChild("Humanoid")
						if Humanoid_6 and Humanoid_6:GetState() ~= Enum.HumanoidStateType.Dead and v_5:FindFirstChild("TEAM") then
							-- KONSTANTERROR: Expression was reused, decompilation is incorrect
							local var110
							if v_5:FindFirstChild("TEAM").Value ~= var110 then
								var110 = nil
								local workspace_Raycast_result1_6 = workspace:Raycast(Handle_2.CFrame.Position, CFrame.new(Handle_2.CFrame.Position, v_5:FindFirstChild("HumanoidRootPart").CFrame.Position).LookVector * 1000, RaycastParams_new_result1_2)
								if workspace_Raycast_result1_6 then
									var110 = workspace_Raycast_result1_6.Instance
								end
								if var110 and var110.Parent and var110:IsDescendantOf(v_5) then
									table.insert(tbl_7, v_5)
								end
							end
						end
					end
				end
				if 0 < #tbl_7 then
					i_6 = 1
					v_5 = #tbl_7
					local var112 = tbl_7[Random.new():NextInteger(i_6, v_5)]
					if var112 then
						local var113
						if var112.Parent then
							local tbl_4 = {}
							var113 = nil
							i_6 = pairs
							v_5 = var112:GetChildren()
							i_6 = i_6(v_5)
							local i_6_result1, i_6_result2, i_6_result3 = i_6(v_5)
							for i_7, v_6 in i_6_result1, i_6_result2, i_6_result3 do
								if arg5 and arg5.PrimaryPart and v_6 and v_6:IsA("BasePart") then
									local var118 = arg5.PrimaryPart.CFrame * CFrame.new(0, 1.5, 0).Position
									local RaycastParams_new_result1_4 = RaycastParams.new()
									RaycastParams_new_result1_4.FilterDescendantsInstances = {v_6, workspace.Map}
									RaycastParams_new_result1_4.FilterType = Enum.RaycastFilterType.Include
									local workspace_Raycast_result1_5 = workspace:Raycast(var118, CFrame.new(var118, v_6.CFrame.Position).LookVector * 2048, RaycastParams_new_result1_4)
									if workspace_Raycast_result1_5 and workspace_Raycast_result1_5.Instance and workspace_Raycast_result1_5.Instance:IsDescendantOf(var112) then
										table.insert(tbl_4, v_6)
									end
								end
							end
							i_6_result1 = #tbl_4
							i_6_result2 = 0
							if i_6_result2 < i_6_result1 then
								i_6_result1 = Random.new()
								i_7 = #tbl_4
								i_6_result1 = i_6_result1:NextInteger(1, i_7)
								var113 = tbl_4[i_6_result1]
							end
							if var113 then
								i_6_result1 = var113.Parent
								if i_6_result1 then
									i_6_result1 = arg2.Health
									i_6_result2 = 0
									local var122
									if i_6_result2 < i_6_result1 then
										v_6 = Instance.new("Part")
										i_6_result1 = v_6
										v_6 = Instance.new("SpecialMesh")
										i_6_result2 = v_6
										v_6 = Instance.new("BodyForce")
										local var123 = v_6
										i_7 = 1.5
										v_6 = Vector3.new(1, 1, 4)
										var122 = Handle_2.CFrame
										var122 = var113.CFrame
										var122 = Random.new():NextInteger(-1.5, 1.5)
										var122 = math.rad(Random.new():NextInteger(-1.5, 1.5))
										i_6_result1.Size = v_6
										i_6_result1.CanCollide = false
										i_6_result1.Color = Color3.fromRGB(255, 125, 125)
										i_6_result1.CFrame = CFrame.new((var122 * arg1.Pods[Random.new():NextInteger(1, #arg1.Pods)]).Position, var122.Position) * CFrame.Angles(math.rad(var122), var122, math.rad(Random.new():NextInteger(-1.5, 1.5)))
										i_6_result1.Name = "TMA-Rocket"
										v_6 = i_6_result1.CFrame.LookVector * arg1.Velocity
										i_6_result1.Velocity = v_6
										v_6 = "rbxassetid://103970395"
										i_6_result2.MeshId = v_6
										i_6_result2.TextureId = "rbxassetid://103967643"
										i_6_result2.Scale = Vector3.new(4.40000, 4.40000, 4.40000)
										i_6_result2.Parent = i_6_result1
										v_6 = Vector3.new(0, i_6_result1:GetMass() * workspace.Gravity, 0)
										var123.Force = v_6
										var123.Parent = i_6_result1
										v_6 = Shared_upvr.CreateTrail
										v_6({
											Object = i_6_result1;
											CustomColor = nil;
											AlignmentType = 'X';
										})
										v_6 = i_6_result1.Touched
										local tbl_3 = {
											Object = i_6_result1;
										}
										tbl_3.NPC = arg5
										tbl_3.Team = arg4
										tbl_3.Humanoid = arg2
										tbl_3.Piercing = false
										local function INLINED_2() -- Internal function, doesn't exist in bytecode
											var122 = var34_upvr.DamageMultiplier
											return var122
										end
										if not var34_upvr or not INLINED_2() then
											var122 = 1
										end
										var122 = Matchmaking_upvr
										tbl_3.Damage = arg1.Damage * var122 * var122["Global Scaling"]
										tbl_3.StatueMult = arg1.StatueMult or 1
										tbl_3.Knockback = nil
										tbl_3.Lifesteal = nil
										var122 = module_upvr
										if 2 > var122.Phases.Level or not script:FindFirstChild("EnemyEffect") then
										end
										tbl_3.Special = nil
										tbl_3.Explosive = true
										tbl_3.Range = arg1.Range
										tbl_3.SFX = arg1.Explode
										tbl_3.Particle = arg1.Particle
										tbl_3.Element = nil
										v_6 = v_6:Connect
										v_6(Shared_upvr.TouchFunction(tbl_3))
										v_6 = workspace.JunkHolder
										i_6_result1.Parent = v_6
										v_6 = i_6_result1:SetNetworkOwner
										v_6(nil)
										v_6 = Shared_upvr.CreateSound
										v_6(arg1.Launch, i_6_result1)
										v_6 = Shared_upvr.Overshoot
										v_6(i_6_result1)
										v_6 = game:GetService("Debris"):AddItem
										v_6(i_6_result1, 5)
									end
								end
							end
							i_6_result1 = wait
							i_6_result2 = arg1.Rate
							i_6_result1(i_6_result2)
						end
					end
				end
			end
		end
	end
end
local RunService_upvr = game:GetService("RunService")
local VFX_upvr = require(Modules.Gameplay.VFX)
local Storyline_upvr = require(Modules.Gameplay.Storyline)
local Resources_upvr = script.Parent:WaitForChild("Resources")
function module_upvr.Attack(arg1) -- Line 302
	--[[ Upvalues[8]:
		[1]: Shared_upvr (readonly)
		[2]: module_upvr (readonly)
		[3]: UseSpecial_upvr (readonly)
		[4]: RunService_upvr (readonly)
		[5]: VFX_upvr (readonly)
		[6]: Storyline_upvr (readonly)
		[7]: Resources_upvr (readonly)
		[8]: Assets_upvr (readonly)
	]]
	local Humanoid_5_upvr = arg1:WaitForChild("Humanoid", 2)
	local TEAM_3_upvr = arg1:WaitForChild("TEAM", 2)
	local PrimaryPart_upvr = arg1.PrimaryPart
	local var134_upvw
	local Stats_upvr = arg1:FindFirstChild("Stats")
	if Stats_upvr then
		Stats_upvr = require(arg1.Stats)
	end
	local function VerifyThisTarget_upvr(arg1_2) -- Line 320, Named "VerifyThisTarget"
		--[[ Upvalues[1]:
			[1]: Stats_upvr (readonly)
		]]
		-- KONSTANTWARNING: Variable analysis failed. Output will have some incorrect variable assignments
		local var136
		if var136 then
			var136 = arg1_2:FindFirstChild("Humanoid")
		end
		if not arg1_2 or Stats_upvr.Ranged ~= true or not arg1_2:FindFirstChild("Head") then
			if arg1_2 then
			end
		end
		if arg1_2 then
			local var137
		end
		if var136 and arg1_2.PrimaryPart and arg1_2:FindFirstChild("TEAM") then
			var137 = false
		end
		-- KONSTANTERROR: Expression was reused, decompilation is incorrect (x2)
		return var137, var136, arg1_2.PrimaryPart, arg1_2:FindFirstChild("TEAM")
	end
	local RaycastParams_new_result1_upvr = RaycastParams.new()
	local function FindClosestTarget_upvr(arg1_3) -- Line 330, Named "FindClosestTarget"
		--[[ Upvalues[7]:
			[1]: PrimaryPart_upvr (readonly)
			[2]: Shared_upvr (copied, readonly)
			[3]: arg1 (readonly)
			[4]: Stats_upvr (readonly)
			[5]: TEAM_3_upvr (readonly)
			[6]: RaycastParams_new_result1_upvr (readonly)
			[7]: VerifyThisTarget_upvr (readonly)
		]]
		local var176 = PrimaryPart_upvr.CFrame * CFrame.new(0, 1.5, 0).Position
		local _, pairs_result2_5, pairs_result3_3 = pairs(workspace:GetChildren())
		local var180
		for _, v_3 in var180, pairs_result2_5, pairs_result3_3 do
			if v_3:FindFirstChild("Humanoid") and v_3.Humanoid:GetState() ~= Enum.HumanoidStateType.Dead and not v_3:FindFirstChildOfClass("ForceField") then
				if v_3 ~= arg1 then
					local Humanoid_4 = v_3:FindFirstChild("Humanoid")
					local var182
					local function INLINED_5() -- Internal function, doesn't exist in bytecode
						var182 = v_3:FindFirstChild("Head")
						return var182
					end
					if Stats_upvr.Ranged ~= true or not INLINED_5() then
						var182 = v_3.PrimaryPart
					end
					if Humanoid_4 and Humanoid_4:GetState() ~= Enum.HumanoidStateType.Dead and var182 and v_3:FindFirstChild("TEAM") then
						-- KONSTANTERROR: Expression was reused, decompilation is incorrect
						local var183
						if v_3:FindFirstChild("TEAM").Value ~= var183 then
							var183 = nil
							RaycastParams_new_result1_upvr.FilterDescendantsInstances = Shared_upvr.CreateIgnoreList(arg1, false, true)
							RaycastParams_new_result1_upvr.FilterType = Enum.RaycastFilterType.Exclude
							RaycastParams_new_result1_upvr.IgnoreWater = true
							local workspace_Raycast_result1_2 = workspace:Raycast(var176, CFrame.new(var176, var182.CFrame.Position).LookVector * 2048, RaycastParams_new_result1_upvr)
							if workspace_Raycast_result1_2 then
								var183 = workspace_Raycast_result1_2.Instance
							end
							if var183 and var183.Parent and var183:IsDescendantOf(v_3) then
								table.insert({}, v_3)
							end
						end
					end
				end
			end
		end
		var180 = nil
		-- KONSTANTERROR: Expression was reused, decompilation is incorrect
		for _, v_4 in pairs({}) do
			local Humanoid = v_4:FindFirstChild("Humanoid")
			local var189
			local function INLINED_6() -- Internal function, doesn't exist in bytecode
				var189 = v_4:FindFirstChild("Head")
				return var189
			end
			if Stats_upvr.Ranged ~= true or not INLINED_6() then
				var189 = v_4.PrimaryPart
			end
			local var190 = var189
			var189 = v_4:FindFirstChild("TEAM")
			if Humanoid then
				var189 = Humanoid:GetState()
				if var189 ~= Enum.HumanoidStateType.Dead then
					var189 = Humanoid.Health
					if 0 < var189 and var190 and var189 then
						-- KONSTANTERROR: Expression was reused, decompilation is incorrect
						var189 = var189.Value
						if var189 ~= TEAM_3_upvr.Value then
							var189 = (var190.Position - arg1_3).Magnitude
							if var189 < math.huge then
								var180 = v_4
								var189 = var190.Position - arg1_3
							end
						end
					end
				end
			end
		end
		local _, VerifyThisTarget_result2, VerifyThisTarget_result3, _ = VerifyThisTarget_upvr(var180)
		-- KONSTANTERROR: Expression was reused, decompilation is incorrect
		return var180, VerifyThisTarget_result2, VerifyThisTarget_result3, v_3:FindFirstChild("TEAM")
	end
	if module_upvr["Special Attacks"].Enabled == true then
		coroutine.wrap(function() -- Line 400
			--[[ Upvalues[8]:
				[1]: module_upvr (copied, readonly)
				[2]: UseSpecial_upvr (copied, readonly)
				[3]: Humanoid_5_upvr (readonly)
				[4]: PrimaryPart_upvr (readonly)
				[5]: TEAM_3_upvr (readonly)
				[6]: arg1 (readonly)
				[7]: var134_upvw (read and write)
				[8]: RunService_upvr (copied, readonly)
			]]
			repeat
				wait(module_upvr["Special Attacks"].Rate * module_upvr["Special Attacks"].Multiplier)
				if module_upvr["Special Attacks"].Used == true then
					module_upvr["Special Attacks"].Used = false
				end
				if module_upvr["Special Attacks"].Used == false and 0 < #module_upvr["Special Attacks"].Moveset then
					local var196 = module_upvr["Special Attacks"].Moveset[Random.new():NextInteger(1, #module_upvr["Special Attacks"].Moveset)]
					UseSpecial_upvr(var196, Humanoid_5_upvr, PrimaryPart_upvr, TEAM_3_upvr, arg1, var134_upvw)
					wait(var196.Cooldown * module_upvr["Special Attacks"].Multiplier)
				end
				RunService_upvr.Heartbeat:Wait()
			until not arg1.Parent and (not Humanoid_5_upvr or Humanoid_5_upvr:GetState() == Enum.HumanoidStateType.Dead) and Humanoid_5_upvr.Health <= 0
		end)()
	end
	local WalkSpeed_upvw = Humanoid_5_upvr.WalkSpeed
	local Aim_upvr = PrimaryPart_upvr.Aim
	local var200_upvw = false
	local RaycastParams_new_result1_upvr_2 = RaycastParams.new()
	coroutine.wrap(function() -- Line 422
		--[[ Upvalues[16]:
			[1]: arg1 (readonly)
			[2]: Humanoid_5_upvr (readonly)
			[3]: FindClosestTarget_upvr (readonly)
			[4]: PrimaryPart_upvr (readonly)
			[5]: module_upvr (copied, readonly)
			[6]: VFX_upvr (copied, readonly)
			[7]: Shared_upvr (copied, readonly)
			[8]: Storyline_upvr (copied, readonly)
			[9]: WalkSpeed_upvw (read and write)
			[10]: var134_upvw (read and write)
			[11]: Stats_upvr (readonly)
			[12]: Aim_upvr (readonly)
			[13]: var200_upvw (read and write)
			[14]: RaycastParams_new_result1_upvr_2 (readonly)
			[15]: Resources_upvr (copied, readonly)
			[16]: Assets_upvr (copied, readonly)
		]]
		-- KONSTANTERROR: [553] 394. Error Block 88 start (CF ANALYSIS FAILED)
		game:GetService("RunService").Heartbeat:Wait()
		-- KONSTANTERROR: [553] 394. Error Block 88 end (CF ANALYSIS FAILED)
		-- KONSTANTERROR: [0] 1. Error Block 127 start (CF ANALYSIS FAILED)
		-- KONSTANTWARNING: Failed to evaluate expression, replaced with nil [564.0]
		-- KONSTANTERROR: [0] 1. Error Block 127 end (CF ANALYSIS FAILED)
	end)()
end
return module_upvr
Assistant: