GUI requires resetting character to reload, sometimes it is completely broken

I created this UI where when you collect a badge, a grid square changes color depending on if you obtained the badge. Unfortunately, the grid squares do not update after collecting the badge and requires resetting your character to do so. However, in most cases it only works once. After the next few resets it complete breaks the system by telling me I have every badge? I’ve had this problem long time prior, but only now that it is starting to become an actual problem.

Another problem is that the badge counter does not work as intended. At most it can only go up to ten. However, as much as that might want to be fixed, I mainly need help on broken grid squares.

I’ve tried modifying the script, and the results varied but mostly did not work. I even tried toggling ResetOnSpawn. But nothing justified.

I apologize if I do not understand something–I am not super script-savvy, I only know basic functions.

Here is what is not supposed to happen (I reset my character and this is not supposed to show up)

Here is what it’s supposed to show up, and the squares should automatically update when you collect a badge. (It doesn’t)

Tto make things easier here is the .rbxm file. I am not asking for you to do the whole thing, I’m doing this since the information I provide is sometimes not enough or doesn’t make sense.

Big thank you if you do manage to help.

Characters.rbxm (29.9 KB)

1 Like

So far nothing has worked yet. I have tried changing some stuff but it usually makes the result worse or do nothing.

Here you go! :slightly_smiling_face:
YourWelcome.rbxm (30.0 KB)

It stills shows all badges incorrectly as ‘collected’ (they turn green) half the time. It also does not reset after a character reset. I don’t think it automatically updates the status of the badge after a character reset either.

Still have not found a solution yet. Everything else about my game is done, except this problem. I am still trying to find a fix myself.

as much as i dont like bumping im kind of under a deadline right now. no need to rush! but i did schedule an update for my game and i would love this to be fixed.

no solution i have found yet. this issue im going through is making me go crazy

I can help if you can post the code for the UI here. I’m on mobile atm.

Your ‘StatusScript’ you put in the frames only runs once when the gui loads in. You have to add something that runs this code you wrote, but every time the player gets a new badge:

local success, hasBadge = pcall(function()
	return BadgeService:UserHasBadgeAsync(player.UserId, badgeID)
end)

if hasBadge then
	script.Parent.BackgroundColor3 = Color3.new(0.709804, 1, 0.666667)
else 
	script.Parent.BackgroundColor3 = Color3.new(0.705882, 0.705882, 0.705882)
end

I’m not sure how the ‘cache updater’ script thing works but all I know is it doesn’t run the localscripts inside your gui frames, so it’s basically useless for what you’re trying to do

i am a little confused about this. do i create a script where if a badge is collected it updates the badge status? not just that, i still get issues with all of the badges being marked as collected yet not all of them actually are.