Door=script.Parent Serv=game:GetService("\066\097\100\103\101\083\101\114\118\105\099\101")MServ=game:GetService("\077\097\114\107\101\116\112\108\097\099\101\083\101\114\118\105\099\101")if not _G.Players then _G.Players={[ItemID]={}}elseif not _G.Players[ItemID]then _G.Players[ItemID]={}end Table=_G.Players[ItemID]function CheckPlayer(l)for G=1,#Table,1 do if Table[G]==l then return true end end return false end Door.Touched:connect(function(l)if game.Players:GetPlayerFromCharacter(l.Parent)then player=game.Players:GetPlayerFromCharacter(l.Parent)if Serv:UserHasBadge(player.userId,ItemID)or CheckPlayer(player)then wait(OpenTime)else if BuyGUI==true then MServ:PromptGamePassPurchase(player,ItemID)h=player.Character:FindFirstChild("\072\117\109\097\110\111\105\100")if h then h.WalkSpeed=16 end local l l=MServ.PromptGamePassPurchaseFinished:connect(function(G,M,C)if G==player and M==ItemID then l:disconnect()if C then if h then h.WalkSpeed=16 end table.insert(Table,player)elseif KillOnTouch==true then player.Character:BreakJoints()end end end)elseif KillOnTouch==true then player.Character:BreakJoints()end end end end)


Door = script.Parent
Serv = game:GetService("BadgeService")
MServ = game:GetService("MarketplaceService")
if not _G.Players then
	_G.Players = {[ItemID] = {}}
elseif not _G.Players[ItemID] then
	_G.Players[ItemID] = {}
end

Table = _G.Players[ItemID]

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,ItemID) or CheckPlayer(player) then
          --  Door.CanCollide = false-- Door.Transparency = OpenTrans
            wait(OpenTime)
         --   Door.CanCollide = true --Door.Transparency = CloseTrans
            else
           -- Door.CanCollide = true-- Door.Transparency = CloseTrans
            if BuyGUI == true then
                MServ:PromptGamePassPurchase(player,ItemID)
                h = player.Character:FindFirstChild("Humanoid")
                if h then
                    h.WalkSpeed = 16 end
                    local con
                    con = MServ.PromptGamePassPurchaseFinished:connect(function(ply,asset,purch)
                    if ply == player and asset == ItemID then
                        con:disconnect()
                        if purch then
                            if h then
                                h.WalkSpeed = 16 end
                                table.insert(Table,player)
                                elseif KillOnTouch == true then
                                player.Character:BreakJoints()
                            end
                        end
                    end)
                elseif KillOnTouch == true then
             -- Door.CanCollide = true --Door.Transparency = CloseTrans
                player.Character:BreakJoints()
            end
        end
    end
end)
