Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

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

Asked by 3 years ago

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

Log in to vote
1
Answered by
uhi_o 417 Moderation Voter
3 years ago

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.

0
Great, thanks. stickymirro511 61 — 3y
Ad
Log in to vote
0
Answered by 3 years ago

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.

0
The problem is I don't know how to use it. stickymirro511 61 — 3y

Answer this question