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.
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
1 | local BadgeService = game:GetService( "BadgeService" ) |
2 | local BadgeId = 0000 --Your badge Id here |
3 |
4 | if BadgeService:UserHasBadgeAsync(game.Players.LocalPlayer.UserId, BadgeID) then |
5 | --Open the door on the client only |
6 | 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.
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.