You will be given a Luau script (that has been decompiled). You…
- User
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_upvrarg1 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:
- Assistant
-- Service Locator local ReplicatedStorage = game:GetService("ReplicatedStorage") local TweenService = game:GetService("TweenService") local Debris = game:GetService("Debris") -- Remote and GUI Elements local DuelRemote = ReplicatedStorage:WaitForChild("Remotes").Misc.DuelRemote local duelGui = script.Parent local invitesFrame = duelGui.Invites local countdownFrame = duelGui.Countdown local interfaceFrame = duelGui.Interface -- Initialize UI Elements invitesFrame.InvTemplate:Destroy() local shineEffect = countdownFrame.Shine local fightLabel = countdownFrame.Fight local numberLabel = countdownFrame.Number local scoreCounter = interfaceFrame.Counter -- UI Visibility States invitesFrame.Visible = true shineEffect.Visible = false fightLabel.Visible = false numberLabel.Visible = false interfaceFrame.Visible = false -- Score Tracking Variables local player1Score = 0 local player2Score = 0 -- Function: Accept Duel local function acceptDuel(opponent) DuelRemote:FireServer("AcceptDuel", opponent) end -- Function: Update Scores and Animate local function updateScore(roundData) local player1CurrentScore = roundData:GetAttribute("Player1Score") local player2CurrentScore = roundData:GetAttribute("Player2Score") scoreCounter.Score1.Text = player1CurrentScore scoreCounter.UserName1.Text = roundData:GetAttribute("Player1") scoreCounter.Score2.Text = player2CurrentScore scoreCounter.UserName2.Text = roundData:GetAttribute("Player2") if player1Score < player1CurrentScore then scoreCounter.Score1.TextColor3 = Color3.new(0.3, 1, 0.3) scoreCounter.Score1.Position = UDim2.new(0.05, 0, -0.1, 0) TweenService:Create(scoreCounter.Score1, 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 player2Score < player2CurrentScore then scoreCounter.Score2.TextColor3 = Color3.new(0.3, 1, 0.3) scoreCounter.Score2.Position = UDim2.new(0.55, 0, -0.1, 0) TweenService:Create(scoreCounter.Score2, 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 player1Score = player1CurrentScore player2Score = player2CurrentScore local soundClone = ReplicatedStorage.Sounds.Duel.PickUp:Clone() soundClone.Parent = duelGui soundClone:Play() Debris:AddItem(soundClone, 2) end -- Function: Format Time for Display local function formatTime(seconds) local minutes = math.floor(seconds / 60) return string.format("%02d:%02d", minutes, seconds - minutes * 60) end -- Table of Functionality for Remote Events local duelEvents = { -- Function: Handle Duel Invite Prompt InvitePrompt = function(opponent) local inviteClone = invitesFrame.InvTemplate:Clone() local mover = inviteClone.Mover inviteClone.Name = "Inv" .. (#invitesFrame:GetChildren()) mover.DuelerText.Text = opponent.Name .. " challenges you to a duel!" inviteClone.Parent = invitesFrame 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() acceptDuel(opponent) invitesFrame:ClearAllChildren() end) mover.Decline.MouseButton1Click:Once(function() inviteClone:Destroy() end) task.delay(10, function() inviteClone:Destroy() end) end, -- Function: Handle Countdown Display Countdown = function(roundData) countdownFrame.Visible = true shineEffect.Visible = false local function fadeOut(textElement) task.delay(0.5, function() TweenService:Create(textElement, TweenInfo.new(0.5, Enum.EasingStyle.Quad, Enum.EasingDirection.In), { TextTransparency = 1, }):Play() TweenService:Create(textElement.UIStroke, TweenInfo.new(0.5, Enum.EasingStyle.Quad, Enum.EasingDirection.In), { Transparency = 1, }):Play() end) end local function makeShine() local shineClone = shineEffect:Clone() shineClone.Visible = true shineClone.Size = UDim2.new(0, 0, 1, 0) shineClone.Parent = countdownFrame Debris:AddItem(shineClone, 1) TweenService:Create(shineClone, 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 numberClone = numberLabel:Clone() numberClone.Visible = true numberClone.Text = tostring(i) numberClone.UIScale.Scale = 0.5 numberClone.TextTransparency = 0 numberClone.UIStroke.Transparency = 0 numberClone.Parent = countdownFrame TweenService:Create(numberClone.UIScale, TweenInfo.new(1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), { Scale = 2, }):Play() fadeOut(numberClone) makeShine() local beepClone = ReplicatedStorage.Sounds.Duel.BeepSound:Clone() beepClone.Parent = duelGui beepClone:Play() Debris:AddItem(beepClone, 2) task.wait(1) end local finalBeep = ReplicatedStorage.Sounds.Duel.BeepSound:Clone() finalBeep.PlaybackSpeed = 1.3 finalBeep.Parent = duelGui finalBeep:Play() Debris:AddItem(finalBeep, 2) fightLabel.Visible = true fightLabel.TextTransparency = 0 fightLabel.UIStroke.Transparency = 0 fightLabel.UIScale.Scale = 0.5 TweenService:Create(fightLabel.UIScale, TweenInfo.new(0.5, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), { Scale = 2, }):Play() fadeOut(fightLabel) fightLabel.Round.Text = "Round " .. roundData:GetAttribute("Round") fightLabel.Round.TextTransparency = 0 fightLabel.Round.UIStroke.Transparency = 0 makeShine() end, -- Function: Manage Duel Interface FollowDuel = function(duelRound) player1Score = 0 player2Score = 0 local timeLeft = duelRound:GetAttribute("TimeLeft") local minutes = math.floor(timeLeft / 60) scoreCounter.Timer.Text = string.format("%02d:%02d", minutes, timeLeft - minutes * 60) interfaceFrame.Position = UDim2.new(0.5, 0, -0.1, 0) interfaceFrame:TweenPosition(UDim2.new(0.5, 0, 0, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.3) interfaceFrame.Visible = true duelRound.AttributeChanged:Connect(function(attribute) if attribute == "Player1Score" or attribute == "Player2Score" then updateScore(duelRound) elseif attribute == "TimeLeft" then local timeLeft = duelRound:GetAttribute("TimeLeft") local minutes = math.floor(timeLeft / 60) scoreCounter.Timer.Text = string.format("%02d:%02d", minutes, timeLeft - minutes * 60) end end) updateScore(duelRound) duelRound.Destroying:Once(function() interfaceFrame.Visible = false end) end, -- Placeholder for ShowWinner functionality ShowWinner = function() -- Add implementation for displaying winner end } -- Connect Remote Events DuelRemote.OnClientEvent:Connect(function(eventName, ...) if duelEvents[eventName] then duelEvents[eventName](...) end end) -- Chat Command Handling and Throttling local isCommandProcessing = false game:GetService("Players").LocalPlayer.Chatted:Connect(function(message) if isCommandProcessing then return end isCommandProcessing = true task.delay(1, function() isCommandProcessing = false end) local lowerMessage = string.lower(message) local subStartIndex = 7 if string.sub(lowerMessage, 1, 6) == "!duel " or string.sub(lowerMessage, 1, 3) == "!d " then if string.sub(lowerMessage, 1, 3) == "!d " then subStartIndex = 4 end local targetName = string.sub(lowerMessage, subStartIndex) local players = game:GetService("Players"):GetPlayers() for _, player in pairs(players) do if string.sub(string.lower(player.Name), 1, string.len(targetName)) == targetName then DuelRemote:FireServer("SendInvite", player) return end end for _, player in pairs(players) do if string.sub(string.lower(player.DisplayName), 1, string.len(targetName)) == targetName then DuelRemote:FireServer("SendInvite", player) return end end elseif string.sub(lowerMessage, 1, 8) == "!forfeit" or string.sub(lowerMessage, 1, 10) == "!surrender" then DuelRemote:FireServer("Forfeit") interfaceFrame.Visible = false end end)