can someone please tell me where i went wrong with this code?
LocalScript (GUI)
local remfunc = game:GetService("ReplicatedStorage").UpdateNames
local list = script.Parent:WaitForChild("ScreenGui").List.List
for _, v in pairs(list:GetChildren()) do
if v:IsA("Frame") then
local GameName = game:GetService("MarketplaceService"):GetProductInfo(v.Name).Name
local badgeID = v:FindFirstChildWhichIsA("UICorner")
if badgeID then
local success, result = remfunc:InvokeServer(tonumber(badgeID.Name))
print(v:FindFirstChild("Name_Desc").Text .. " " .. tostring(result))
if success and result == true then
v.BackgroundColor3 = Color3.fromRGB(20, 36, 44)
end
end
local text = list:FindFirstChild(v.Name).GameName
text.Text = GameName
end
end
Script (BadgeService)
local badgeS = game:GetService("BadgeService")
local event = game:GetService("ReplicatedStorage"):WaitForChild("UpdateNames")
event.OnServerInvoke = (function(player, name)
local maxtries = 3
local tries = 0
local success, response
repeat
tries += 1
success, response = pcall(function()
badgeS:UserHasBadgeAsync(player.UserId, name)
end)
if not success then
warn("didnt work on try" .. tostring(tries) .. " because " .. response)
end
until success or tries >= maxtries
return success, response
end)
v.name in the local script is a placeID
and the uicorner.name is the badgeID