You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
Optimized and good performance -
What is the issue? Include screenshots / videos if possible!
Memory Leaks

game:GetService("Players").PlayerAdded:Connect(function(player)
spawn(function()
while true do
local success, error = pcall(function()
if player:WaitForChild("PlayerGui") and player.PlayerGui:WaitForChild("ScreenGui") and player.PlayerGui.ScreenGui:WaitForChild("Frame") then
if player.PlayerGui.ScreenGui.Frame.Frame.ScrollingFrame and player.PlayerGui.ScreenGui.Frame.Frame.ScrollingFrame.Frame then
local reference = player.PlayerGui.ScreenGui.Frame.Frame.ScrollingFrame.Frame
for i,v in pairs(reference.Parent:GetChildren()) do
if v.Name ~= "Frame" and v.Name ~= "UIGridLayout" then
v:Destroy() -- refresh
end
end
if player.PlayerGui.ScreenGui.Frame.Frame:FindFirstChild("TextButton") then
player.PlayerGui.ScreenGui.Frame.Frame:FindFirstChild("TextButton").Visible = false
end
if player.PlayerGui.ScreenGui.Frame.Frame:FindFirstChild("TextButton2") then
player.PlayerGui.ScreenGui.Frame.Frame:FindFirstChild("TextButton2").Visible = false
end
local tablenumber = {}
progress = {}
for i,gametable in pairs(classic) do
for rewardtype,v in pairs(gametable) do
task.spawn(function()
local awarded,winrate,gamename,badgename = GetBadgeInfo(v)
print("Game = " .. v .. "\n" .. "Badge = " .. i.. "\n" .. "\n" .. "Total Awarded = " .. awarded .. "\n" .. "Win Rate Percentage = " .. winrate)
local clone = reference:Clone()
clone.Parent = reference.Parent
clone.Visible = true
clone.Owned.Visible = false
clone.Owned.Value.Value = false
if gamename then
clone.TextLabel.Text = gamename .. "\n(" .. i .. ")"
end
if badgename then
clone.TextLabel.Text = clone.TextLabel.Text .. "\nBadge Name: " .. badgename
end
if awarded then
clone.TextLabel.Text = clone.TextLabel.Text .. "\nTotal Awarded: " .. awarded
table.insert(tablenumber,awarded)
end
if winrate then
clone.TextLabel.Text = clone.TextLabel.Text .. "\nWin Percentage: " .. winrate .. "%"
end
task.spawn(function()
if string.find(rewardtype,"Tix") then
clone.Reward.Image = "http://www.roblox.com/asset/?id=17570376909"
else
clone.Reward.Image = "http://www.roblox.com/asset/?id=17570342764"
end
end)
clone.Thing.Name = tostring(i)
clone.ImageLabel.Image = "rbxthumb://type=Asset&id=" .. i .. "&w=420&h=420"
clone.Name = tostring(awarded)
clone.Join.Gameid.Value = tonumber(i)
local suczez, eror = pcall(function()
if GetBadgeOwnership(player, v) then
clone.Owned.Visible = true
clone.Owned.Value.Value = true
table.insert(progress,"e")
end
end)
if suczez then
warn("succes")
--[[else
warn(eror)
print("Sending to client!")
task.spawn(function()
game.ReplicatedStorage.BadgeHandler:InvokeClient(player,v,awarded)
end)]]
end
end)
task.wait()
if rewardtype == "Tix 10" or rewardtype == "Token 5" then
sortTableDescending(tablenumber)
end
end
task.spawn(function()
for i=1,3 do
for i,v in pairs(tablenumber) do
if reference.Parent:FindFirstChild(tostring(v)) then
reference.Parent:FindFirstChild(tostring(v)).LayoutOrder = i
end
end
task.wait(5)
end
task.wait()
end)
if player.PlayerGui.ScreenGui.Frame.Frame:FindFirstChild("TextButton") then
player.PlayerGui.ScreenGui.Frame.Frame:FindFirstChild("TextButton").Visible = true
end
if player.PlayerGui.ScreenGui.Frame.Frame:FindFirstChild("TextButton2") then
player.PlayerGui.ScreenGui.Frame.Frame:FindFirstChild("TextButton2").Visible = true
end
player.PlayerGui.ScreenGui.Frame.Frame.Progress.Text = "Progress:\n" .. tostring(#progress) .. "/225 badges\n" .. tostring(math.round((#progress * 225) / 100,2)) .. "% Completed\nBadge Progress may not load due to ratelimit."
--[[local succeses, error_message = pcall(function()
for i,v in pairs(game:GetService("HttpService"):JSONDecode(game:GetService("HttpService"):GetAsync("https://offpath.gg/the-hunt.json"))) do
if reference.Parent:FindFirstChild(tostring(v.game_id),true) then
print(v.name)
reference.Parent:FindFirstChild(tostring(v.game_id),true).Parent.TextLabel.Text = reference.Parent:FindFirstChild(tostring(v.game_id),true).Parent.TextLabel.Text .. "\nBadges/1k Visits: " .. v.badges_per_visit
end
end
end)
if not succeses then
print("Error occurred:", error_message)
end]]
end
end
end
end)
if success then
warn(success)
else
warn(error)
end
for i = 1,300 do
if player:WaitForChild("PlayerGui") and player.PlayerGui:WaitForChild("ScreenGui") and player.PlayerGui.ScreenGui:WaitForChild("Frame") and player.PlayerGui.ScreenGui.Frame:WaitForChild("Frame") and player.PlayerGui.ScreenGui.Frame.Frame:WaitForChild("Refreshtime") then
player.PlayerGui.ScreenGui.Frame.Frame.Refreshtime.Text = "Refreshes in:\n" .. tostring(300 - i) .. " seconds."
if i % 5 == 0 then
game.ReplicatedStorage.BadgeHandler:InvokeClient(player,progress)
end
task.wait(1)
end
end
end
end)
end)```

