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

How can I make a badge powered door that kills people who do not own the badge?

I have been searching everywhere, but I am unable to find an answer that works (which is why I am not including a script).

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)

learn more here

3 comments

0

This didn't work. There isn't a part where the collison from the door is false for a few seconds.

0

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

0

like @Kyokamii said, this should work... otherwise, i am not sure of what your looking for.

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