I have been searching everywhere, but I am unable to find an answer that works (which is why I am not including a script).
COMMUNITY QUESTION
How can I make a badge powered door that kills people who do not own the badge?
1 answer
you would have to use the BadgeService;
like this:
local Players = game:GetService("Players")
local BadgeService = game:GetService("BadgeService");
local badgeId = 0000000- badge Id
local door = --the door part that gets touched;
door.Touched:Connect(function(part)
local player = Players:GetPlayerFromCharacter(part.Parent);
if(player) then
local character = part.Parent
local userId = player.UserId;
local OwnsBadge = BadgeService:UserHasBadgeAsync(userId, badgeId);
if(not OwnsBadge) then
character.Humanoid.Health = character.Humanoid.Health - character.Humanoid.MaxHealth
end
end
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.

3 comments
This didn't work. There isn't a part where the collison from the door is false for a few seconds.
This should work if you added the proper edits to the code. Also, you could just set the humanoid's health to 0 instead of removing the maxhealth, seems like unnecessary math
like @Kyokamii said, this should work... otherwise, i am not sure of what your looking for.