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

Attempting to make a badge activated door. Anyone know how?

I'm trying to make a door that only opens if you own a certain badge. Also, is there a way to make it localized so someone can't tailgate behind someone who has the badge? Thanks.

2 answers

✓ Accepted answer

There is a Service called "BadgeService" which is used to give players badges and do other stuff such as check if they own the badge in your case.

Here's a small example that would be used on a LocalScript

local BadgeService = game:GetService("BadgeService")
local BadgeId = 0000 --Your badge Id here

if BadgeService:UserHasBadgeAsync(game.Players.LocalPlayer.UserId, BadgeID) then
    --Open the door on the client only
end

Basically, LocaScripts do not replicate to the server, which means that LocalScript are only visible for the "current" player that the script executed correctly for.

Here is a link I have followed while posting my reply https://developer.roblox.com/en-us/api-reference/function/BadgeService/UserHasBadgeAsync

I'll let you handle the rest such as the open/closing of the door and awarding the badge.

1 comment

0

Great, thanks.

I believe that there is an event that checks if a player owns a badge, you can use that. To make it localized you can use a local script.

1 comment

0

The problem is I don't know how to use it.

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