Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Help with Badges with Roblox Servers?

Image won't change if a player has a badge, how come?

game.Players.PlayerAdded:connect(function(player)
	repeat wait() until player.Character
	-- Welcome Badge --
	while wait() do
		if game:GetService('BadgeService'):UserHasBadge(player.userId, 193507707)then
			script.Parent.Badge1.Images.Badge1.Image = "rbxassetid://193507669"
		else
			script.Parent.Badge1.Images.Badge1.Image = "rbxassetid://193930788"
		end
	end
end)

1 answer

✓ Accepted answer

What I think is happening is the script is loading before the player even can say "Hi I'm here" so what I recommend adding is after line one do: repeat wait() until player.Character

that way it will wait for the player's character to finish loading then it will execute the while loop.

Another thing is I recommend putting a stop to the while loop once your done with it by adding a "break"

2 comments

0

i cant add break, cause thers multiple badges inside it to check for.

0

and still dosent work, theres no errors, but the image to the gui dosent change, I eddited my answer with a full thing

This discussion is preserved as it was. New answers, comments, and votes are closed.