-----------------------------------------------------------------------------------------------


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 Gamepass <= 0 then return nil end
		if MS:UserOwnsGamePassAsync(plr.UserId, Gamepass) 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
				MS:PromptGamePassPurchase(plr, Gamepass)
			end
			if KillOnTouch == true then
				plr.Character.Humanoid.Health = 0
			end
		end
	end
end)
