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

Attempting to make a badge activated door?

Asked by 7 years ago

I want to make a VIP door only to be passed by those with a specific badge.

Is this the same as a gamepass door? just with the badge id?

(the heck is with the title rules xD)

0
where is your code? we need to know what you have so far in order to answer!!! starlebVerse 685 — 7y

1 answer

Log in to vote
0
Answered by
Ae_ka 0
7 years ago

This is pretty easy, it's the same as GamepassService but just with BadgeService.

local Door = game.Workspace.VipBadgeDoor --or you could just do script.Parent

function onTouched(hit) 
    local human = hit.Parent:findFirstChild("Humanoid") 
    if (human ~= nil ) then 
        if game:GetService("BadgeService"):UserHasBadge(game.Players[human.Parent.Name].userId, script.Parent.BadgeID.Value) ~= false then  
            Door.Transparency = 0.5 --you can change it if you'd like to
            Door.CanCollide = false --player can walk through the door
            wait(4) --the door will be open for 4 seconds 
            Door.CanCollide = true  --player cant walk through the door
        end 
    end 
end 

script.Parent.Touched:connect(onTouched)

Haven't tested this, but it should probably work.

Note: Make a IntValue in the door and name it BadgeID (or whatever you want to, you just have to change it in the script).

And for the door you can just make a big brick or something.

0
Just use the Copy to clipboard option on this website if you want to paste it in. Ae_ka 0 — 7y
Ad

Answer this question