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

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

Asked by 4 years ago

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

Log in to vote
1
Answered by 4 years ago
Edited 4 years ago

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

0
This didn't work. There isn't a part where the collison from the door is false for a few seconds. BudyGon 0 — 4y
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 Kyokamii 133 — 4y
0
like @Kyokamii said, this should work... otherwise, i am not sure of what your looking for. User#23252 26 — 4y
Ad

Answer this question