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

How to make a "Check if user has a Badge then..." ?

--I'm doing an Egg Hunt 2020 Helper Game Everything is already working but, i want to make like... if you have the badge of the egg of a certain game, the red portal will turn into green.

Please help, i'm trying to make my friend get all the eggs.

I think its something like that

if game.workspace. ???? 
???? -- that's all i can think of.

Please help before: april 28th

1 answer

✓ Accepted answer

You can use BadgeService’s :UserHasBadgeAsync() method to verify whether a Player owns a Badge. This method will require two arguments, that of which is the AssetId of the Badge, and the UserId of the Player to uplink the account for confirmation.

This function’s return type is a boolean, therefore we can use it in conjunction with a conditional statement.

local BadgeService = game:GetService("BadgeService")
local BadgeId = --// ID

local Player = game:GetService("Players").LocalPlayer

if (BadgeService:UserHasBadgeAsync(BadgeId, Player.UserId) then
    --// Adjust BrickColor of BasePart to green.
end

Remember to accept this answer if it helps!

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