Updated!!!!
I managed to fix the last issue with raid6n's suggestion. However I still have issues with this. My problem now is that when the user does not own badge the "note.Visible = true" doesn't make the note appear. Someone told me it's because the StarterGui... blah blah get moved somewhere else. That's all I remember, can someone help with that?
local note = game.StarterGui.MainGui.Note local player = game:GetService("Players") local badgeid = 2124518313 local BadgeService = game:GetService("BadgeService") player.PlayerAdded:Connect(function(player) if BadgeService:UserHasBadgeAsync(player.UserId, badgeid) then print("User owns badge, do not display note.") else print("User does not own badge, display note.") note.Visible = true end end)
Do
if BadgeService:UserHasBadgeAsync(player.UserId, badgeid) then
on line 7.https://developer.roblox.com/en-us/api-reference/function/BadgeService/UserHasBadgeAsync
What raid6n said is correct, but you would need a constant check if the user earned the badge. You would need to put that in a while loop.
local player = game:GetService("Players") local badgeid = 2124518313 local BadgeService = game:GetService("BadgeService") player.PlayerAdded:Connect(function(player) while true do wait(10) --10 seems fair enough if BadgeService:UserHasBadgeAsync(player.UserId, badgeid) then print("User owns badge, do not display note.") else print("User does not own badge, display note.") player.PlayerGui.MainGui.Note.Visible = true end end end)
Or you can always do a check when you give the badge to the user to avoid while loops.
Since there is always another way than using while loops.
Do if BadgeService:UserHasBadgeAsync(player.UserId, badgeid) then
on line 7.
https://developer.roblox.com/en-us/api-reference/function/BadgeService/UserHasBadgeAsync