**
If you'd like a gamepass door, here's this. I am kind of confused on what you needed, a VIP door or normal door.**
PassOrShirtID = (INSERTBADGEID)
Door = script.Parent
OpenTime = (INSERTTIMEOPENED)
Prompt = true
Serv = game:GetService("BadgeService")
MServ = game:GetService("MarketplaceService")
if not _G.Players then
_G.Players = {
[PassOrShirtID] = {};
}
print("Players Created")
elseif not _G.Players[PassOrShirtID] then
_G.Players[PassOrShirtID] = {};
print("Players.Pass created")
end
Table = _G.Players[PassOrShirtID]
function CheckPlayer(player2)
for i = 1,#Table do
if Table[i] == player2 then
return true
end
end
return false
end
Door.Touched:connect(function(hit)
if game.Players:GetPlayerFromCharacter(hit.Parent) then
player = game.Players:GetPlayerFromCharacter(hit.Parent)
if Serv:UserHasBadge(player.userId,PassOrShirtID) or CheckPlayer(player) then
Door.CanCollide = false; Door.Transparency = 0.5;
wait(OpenTime);
Door.CanCollide = true; Door.Transparency = 0;
else
if Prompt then
MServ:PromptPurchase(player,PassOrShirtID)
h = player.Character:FindFirstChild("Humanoid")
if h then h.WalkSpeed = 0 end
local con;
con = MServ.PromptPurchaseFinished:connect(function(ply,asset,purch)
if ply == player and asset == PassOrShirtID then
con:disconnect()
if purch then
if h then h.WalkSpeed = 16 end
table.insert(Table,player)
else
player.Character:BreakJoints()
end
end
end)
else
player.Character:BreakJoints()
end
end
end
end)
2 comments
I think i mucked up the loop slightly
Please edit your post to use Lua code formatting