Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local BS = game:GetService("BadgeService")
- local Badge = 2130281077 -- The ID of the Gamepass.
- local OpenTime = 1 -- The time the door is open for.
- local OpenTrans = 0.5 -- The transparency of the door when it is open.
- local CloseTrans = 0 -- The transparency of the door when it is closed.
- local BuyGUI = false -- Set to false to stop the BuyGUI appearing.
- local KillOnTouch = true -- Set to false to stop players being killed when they touch it.
- local Whitelist = {
- 1
- } -- USERID || People that can open the door without owning the badge.
- -----------------------------------------------------------------------------------------------
- local Door = script.Parent -- The door
- -----------------------------------------------------------------------------------------------
- function CheckWhitelist(v)
- for i = 1, #Whitelist do
- if v == Whitelist[i] then
- return true
- end
- end
- return false
- end
- Door.Touched:Connect(function(hit)
- if game.Players:GetPlayerFromCharacter(hit.Parent) then
- local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
- if Badge <= 0 then return nil end
- if BS:UserHasBadgeAsync(plr.UserId, Badge) or CheckWhitelist(plr.UserId) then
- Door.CanCollide, Door.Transparency = false, OpenTrans
- wait(OpenTime)
- Door.CanCollide, Door.Transparency = true, CloseTrans
- else
- Door.CanCollide, Door.Transparency = true, CloseTrans
- if BuyGUI == true then
- BS:PromptGamePassPurchase(plr, Badge)
- end
- if KillOnTouch == true then
- plr.Character.Humanoid.Health = 0
- end
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment