Assistant: 
User: 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: -- Decompiled with Konstant V2.1, a fast Luau decompiler made in Luau by plusgiant5 (https://discord.gg/wyButjTMhM)
-- Decompiled on 2024-10-06 16:51:05
-- Luau version 6, Types version 3
-- Time taken: 0.007531 seconds

local ReplicatedStorage_upvr = game:GetService("ReplicatedStorage")
local TweenService_upvr = game:GetService("TweenService")
local Debris_upvr = game:GetService("Debris")
local DuelRemote_upvr = ReplicatedStorage_upvr:WaitForChild("Remotes").Misc.DuelRemote
local Parent_upvr = script.Parent
local Invites_upvr = Parent_upvr.Invites
Invites_upvr.InvTemplate:Destroy()
local Countdown_upvr = Parent_upvr.Countdown
local Shine_upvr = Countdown_upvr.Shine
local Fight_upvr = Countdown_upvr.Fight
local Number_upvr = Countdown_upvr.Number
local Interface_upvr = Parent_upvr.Interface
local Counter_upvr = Interface_upvr.Counter
Invites_upvr.Visible = true
Shine_upvr.Visible = false
Fight_upvr.Visible = false
Number_upvr.Visible = false
Interface_upvr.Visible = false
local var13_upvw = 0
local var14_upvw = 0
local function _(arg1) -- Line 42, Named "AcceptDuel"
	--[[ Upvalues[1]:
		[1]: DuelRemote_upvr (readonly)
	]]
	DuelRemote_upvr:FireServer("AcceptDuel", arg1)
end
local clone_7_upvr = Invites_upvr.InvTemplate:Clone()
local Score1_upvr = Counter_upvr.Score1
local Score2_upvr = Counter_upvr.Score2
local function UpdateScore_upvr(arg1) -- Line 129, Named "UpdateScore"
	--[[ Upvalues[9]:
		[1]: Score1_upvr (readonly)
		[2]: Counter_upvr (readonly)
		[3]: Score2_upvr (readonly)
		[4]: var13_upvw (read and write)
		[5]: TweenService_upvr (readonly)
		[6]: var14_upvw (read and write)
		[7]: ReplicatedStorage_upvr (readonly)
		[8]: Parent_upvr (readonly)
		[9]: Debris_upvr (readonly)
	]]
	local Player1Score = arg1:GetAttribute("Player1Score")
	local Player2Score = arg1:GetAttribute("Player2Score")
	Score1_upvr.Text = Player1Score
	Counter_upvr.UserName1.Text = arg1:GetAttribute("Player1")
	Score2_upvr.Text = Player2Score
	Counter_upvr.UserName2.Text = arg1:GetAttribute("Player2")
	if var13_upvw < Player1Score then
		Score1_upvr.TextColor3 = Color3.new(0.3, 1, 0.3)
		Score1_upvr.Position = UDim2.new(0.05, 0, -0.1, 0)
		TweenService_upvr:Create(Score1_upvr, TweenInfo.new(0.3, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {
			TextColor3 = Color3.new(1, 1, 1);
			Position = UDim2.new(0.05, 0, 0, 0);
		}):Play()
	end
	if var14_upvw < Player2Score then
		Score2_upvr.TextColor3 = Color3.new(0.3, 1, 0.3)
		Score2_upvr.Position = UDim2.new(0.55, 0, -0.1, 0)
		TweenService_upvr:Create(Score2_upvr, TweenInfo.new(0.3, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {
			TextColor3 = Color3.new(1, 1, 1);
			Position = UDim2.new(0.55, 0, 0, 0);
		}):Play()
	end
	var13_upvw = Player1Score
	var14_upvw = Player2Score
	local clone = ReplicatedStorage_upvr.Sounds.Duel.PickUp:Clone()
	clone.Parent = Parent_upvr
	clone:Play()
	Debris_upvr:AddItem(clone, 2)
end
local function _(arg1) -- Line 159, Named "FormatTime"
	local floored = math.floor(arg1 / 60)
	return string.format("%02d:%02d", floored, arg1 - floored * 60)
end
local tbl_upvr = {
	InvitePrompt = function(arg1) -- Line 46, Named "GetInvite"
		--[[ Upvalues[3]:
			[1]: clone_7_upvr (readonly)
			[2]: Invites_upvr (readonly)
			[3]: DuelRemote_upvr (readonly)
		]]
		local clone_6_upvr = clone_7_upvr:Clone()
		local Mover = clone_6_upvr.Mover
		clone_6_upvr.Name = "Inv"..(#Invites_upvr:GetChildren())
		Mover.DuelerText.Text = arg1.Name.." challenges you to a duel!"
		clone_6_upvr.Parent = Invites_upvr
		Mover.Position = UDim2.new(1, 0, 0, 0)
		Mover:TweenPosition(UDim2.new(0, 0, 0, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.5)
		Mover.Accept.MouseButton1Click:Once(function() -- Line 56
			--[[ Upvalues[3]:
				[1]: arg1 (readonly)
				[2]: DuelRemote_upvr (copied, readonly)
				[3]: Invites_upvr (copied, readonly)
			]]
			DuelRemote_upvr:FireServer("AcceptDuel", arg1)
			Invites_upvr:ClearAllChildren()
		end)
		Mover.Decline.MouseButton1Click:Once(function() -- Line 60
			--[[ Upvalues[1]:
				[1]: clone_6_upvr (readonly)
			]]
			clone_6_upvr:Destroy()
		end)
		task.delay(10, function() -- Line 63
			--[[ Upvalues[1]:
				[1]: clone_6_upvr (readonly)
			]]
			clone_6_upvr:Destroy()
		end)
	end;
	Countdown = function(arg1) -- Line 68, Named "DoCountdown"
		--[[ Upvalues[8]:
			[1]: Countdown_upvr (readonly)
			[2]: Shine_upvr (readonly)
			[3]: TweenService_upvr (readonly)
			[4]: Debris_upvr (readonly)
			[5]: Number_upvr (readonly)
			[6]: ReplicatedStorage_upvr (readonly)
			[7]: Parent_upvr (readonly)
			[8]: Fight_upvr (readonly)
		]]
		Countdown_upvr.Visible = true
		Shine_upvr.Visible = false
		local function _(arg1_2) -- Line 74, Named "FadeOut"
			--[[ Upvalues[1]:
				[1]: TweenService_upvr (copied, readonly)
			]]
			task.delay(0.5, function() -- Line 75
				--[[ Upvalues[2]:
					[1]: TweenService_upvr (copied, readonly)
					[2]: arg1_2 (readonly)
				]]
				TweenService_upvr:Create(arg1_2, TweenInfo.new(0.5, Enum.EasingStyle.Quad, Enum.EasingDirection.In), {
					TextTransparency = 1;
				}):Play()
				TweenService_upvr:Create(arg1_2.UIStroke, TweenInfo.new(0.5, Enum.EasingStyle.Quad, Enum.EasingDirection.In), {
					Transparency = 1;
				}):Play()
			end)
		end
		local function MakeShine() -- Line 81
			--[[ Upvalues[4]:
				[1]: Shine_upvr (copied, readonly)
				[2]: Countdown_upvr (copied, readonly)
				[3]: Debris_upvr (copied, readonly)
				[4]: TweenService_upvr (copied, readonly)
			]]
			local clone_4 = Shine_upvr:Clone()
			clone_4.Visible = true
			clone_4.Size = UDim2.new(0, 0, 1, 0)
			clone_4.Parent = Countdown_upvr
			Debris_upvr:AddItem(clone_4, 1)
			TweenService_upvr:Create(clone_4, TweenInfo.new(1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {
				ImageTransparency = 1;
				Size = UDim2.new(2, 0, 0.5, 0);
			}):Play()
		end
		for i = 3, 1, -1 do
			local clone_3_upvr = Number_upvr:Clone()
			clone_3_upvr.Visible = true
			clone_3_upvr.Text = i
			clone_3_upvr.UIScale.Scale = 0.5
			clone_3_upvr.TextTransparency = 0
			clone_3_upvr.UIStroke.Transparency = 0
			clone_3_upvr.Parent = Countdown_upvr
			TweenService_upvr:Create(clone_3_upvr.UIScale, TweenInfo.new(1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {
				Scale = 2;
			}):Play()
			task.delay(0.5, function() -- Line 75
				--[[ Upvalues[2]:
					[1]: TweenService_upvr (copied, readonly)
					[2]: clone_3_upvr (readonly)
				]]
				TweenService_upvr:Create(clone_3_upvr, TweenInfo.new(0.5, Enum.EasingStyle.Quad, Enum.EasingDirection.In), {
					TextTransparency = 1;
				}):Play()
				TweenService_upvr:Create(clone_3_upvr.UIStroke, TweenInfo.new(0.5, Enum.EasingStyle.Quad, Enum.EasingDirection.In), {
					Transparency = 1;
				}):Play()
			end)
			MakeShine()
			local clone_5 = ReplicatedStorage_upvr.Sounds.Duel.BeepSound:Clone()
			clone_5.Parent = Parent_upvr
			clone_5:Play()
			Debris_upvr:AddItem(clone_5, 2)
			task.wait(1)
		end
		clone_3_upvr = ReplicatedStorage_upvr
		local clone_2 = clone_3_upvr.Sounds.Duel.BeepSound:Clone()
		clone_2.PlaybackSpeed = 1.3
		clone_2.Parent = Parent_upvr
		clone_2:Play()
		clone_3_upvr = clone_2
		Debris_upvr:AddItem(clone_3_upvr, 2)
		Fight_upvr.Visible = true
		Fight_upvr.TextTransparency = 0
		Fight_upvr.UIStroke.Transparency = 0
		Fight_upvr.UIScale.Scale = 0.5
		clone_3_upvr = Fight_upvr.UIScale
		TweenService_upvr:Create(clone_3_upvr, TweenInfo.new(0.5, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {
			Scale = 2;
		}):Play()
		clone_3_upvr = 0.5
		task.delay(clone_3_upvr, function() -- Line 75
			--[[ Upvalues[2]:
				[1]: TweenService_upvr (copied, readonly)
				[2]: Fight_upvr (readonly)
			]]
			TweenService_upvr:Create(Fight_upvr, TweenInfo.new(0.5, Enum.EasingStyle.Quad, Enum.EasingDirection.In), {
				TextTransparency = 1;
			}):Play()
			TweenService_upvr:Create(Fight_upvr.UIStroke, TweenInfo.new(0.5, Enum.EasingStyle.Quad, Enum.EasingDirection.In), {
				Transparency = 1;
			}):Play()
		end)
		clone_3_upvr = "Round "
		Fight_upvr.Round.Text = clone_3_upvr..arg1:GetAttribute("Round")
		Fight_upvr.Round.TextTransparency = 0
		clone_3_upvr = Fight_upvr
		clone_3_upvr.Round.UIStroke.Transparency = 0
		clone_3_upvr = 0.5
		local Round_upvr = Fight_upvr.Round
		task.delay(clone_3_upvr, function() -- Line 75
			--[[ Upvalues[2]:
				[1]: TweenService_upvr (copied, readonly)
				[2]: Round_upvr (readonly)
			]]
			TweenService_upvr:Create(Round_upvr, TweenInfo.new(0.5, Enum.EasingStyle.Quad, Enum.EasingDirection.In), {
				TextTransparency = 1;
			}):Play()
			TweenService_upvr:Create(Round_upvr.UIStroke, TweenInfo.new(0.5, Enum.EasingStyle.Quad, Enum.EasingDirection.In), {
				Transparency = 1;
			}):Play()
		end)
		Round_upvr = MakeShine
		Round_upvr()
	end;
	FollowDuel = function(arg1) -- Line 165, Named "DuelInterface"
		--[[ Upvalues[5]:
			[1]: var13_upvw (read and write)
			[2]: var14_upvw (read and write)
			[3]: Counter_upvr (readonly)
			[4]: Interface_upvr (readonly)
			[5]: UpdateScore_upvr (readonly)
		]]
		var13_upvw = 0
		var14_upvw = 0
		local TimeLeft_2 = arg1:GetAttribute("TimeLeft")
		local floored_2 = math.floor(TimeLeft_2 / 60)
		Counter_upvr.Timer.Text = string.format("%02d:%02d", floored_2, TimeLeft_2 - floored_2 * 60)
		Interface_upvr.Position = UDim2.new(0.5, 0, -0.1, 0)
		Interface_upvr:TweenPosition(UDim2.new(0.5, 0, 0, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.3)
		Interface_upvr.Visible = true
		arg1.AttributeChanged:Connect(function(arg1_3) -- Line 172
			--[[ Upvalues[3]:
				[1]: UpdateScore_upvr (copied, readonly)
				[2]: arg1 (readonly)
				[3]: Counter_upvr (copied, readonly)
			]]
			if arg1_3 == "Player1Score" or arg1_3 == "Player2Score" then
				UpdateScore_upvr(arg1)
			elseif arg1_3 == "TimeLeft" then
				local TimeLeft = arg1:GetAttribute("TimeLeft")
				local floored_3 = math.floor(TimeLeft / 60)
				Counter_upvr.Timer.Text = string.format("%02d:%02d", floored_3, TimeLeft - floored_3 * 60)
			end
		end)
		UpdateScore_upvr(arg1)
		arg1.Destroying:Once(function() -- Line 182
			--[[ Upvalues[1]:
				[1]: Interface_upvr (copied, readonly)
			]]
			Interface_upvr.Visible = false
		end)
	end;
	ShowWinner = function() -- Line 187, Named "ShowWinner"
	end;
}
DuelRemote_upvr.OnClientEvent:Connect(function(arg1, ...) -- Line 199
	--[[ Upvalues[1]:
		[1]: tbl_upvr (readonly)
	]]
	if tbl_upvr[arg1] then
		tbl_upvr[arg1](...)
	end
end)
local var60_upvw = false
game:GetService("Players").LocalPlayer.Chatted:Connect(function(arg1) -- Line 205
	--[[ Upvalues[3]:
		[1]: var60_upvw (read and write)
		[2]: DuelRemote_upvr (readonly)
		[3]: Interface_upvr (readonly)
	]]
	if var60_upvw then
	else
		var60_upvw = true
		task.delay(1, function() -- Line 210
			--[[ Upvalues[1]:
				[1]: var60_upvw (copied, read and write)
			]]
			var60_upvw = false
		end)
		local string_lower_result1 = string.lower(arg1)
		local var71 = 7
		if string.sub(string_lower_result1, 1, 6) == "!duel " or string.sub(string_lower_result1, 1, 3) == "!d " then
			if string.sub(string_lower_result1, 1, 3) == "!d " then
				var71 = 4
			end
			local string_sub_result1 = string.sub(string_lower_result1, var71, string.len(string_lower_result1))
			local players = game:GetService("Players"):GetPlayers()
			for _, v in pairs(players) do
				if string.sub(string.lower(v.Name), 1, string.len(string_sub_result1)) == string_sub_result1 then
					DuelRemote_upvr:FireServer("SendInvite", v)
					return
				end
			end
			for _, v_2 in pairs(players) do
				if string.sub(string.lower(v_2.DisplayName), 1, string.len(string_sub_result1)) == string_sub_result1 then
					DuelRemote_upvr:FireServer("SendInvite", v_2)
					return
				end
			end
			return
		end
		if string.sub(string_lower_result1, 1, 8) == "!forfeit" or string.sub(string_lower_result1, 1, 10) == "!surrender" then
			DuelRemote_upvr:FireServer("Forfeit")
			Interface_upvr.Visible = false
		end
	end
end)
Assistant:
Assistant: