Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local vipDoor = workspace:WaitForChild("VIPDoor")
- local vipId = 8833520
- local cafeWorkerDoor = workspace:WaitForChild("CafeWorkerDoor")
- local cafeWorkerId = 8833515
- local marketplaceService = game:GetService("MarketplaceService")
- local physicsService = game:GetService("PhysicsService")
- physicsService:CreateCollisionGroup("VIPPlayers")
- physicsService:CreateCollisionGroup("VIPDoor")
- physicsService:CollisionGroupSetCollidable("VIPPlayers", "VIPDoor", false)
- physicsService:CreateCollisionGroup("CafeWorkers")
- physicsService:CreateCollisionGroup("CafeWorkerDoor")
- physicsService:CollisionGroupSetCollidable("CafeWorkers", "CafeWorkerDoor", false)
- physicsService:CreateCollisionGroup("CafeWorkerAndVIP")
- physicsService:CollisionGroupSetCollidable("CafeWorkerAndVIP", "VIPDoor", false)
- physicsService:CollisionGroupSetCollidable("CafeWorkerAndVIP", "CafeWorkerDoor", false)
- physicsService:SetPartCollisionGroup(vipDoor, "VIPDoor")
- physicsService:SetPartCollisionGroup(cafeWorkerDoor, "CafeWorkerDoor")
- local function addToGroup(character, group)
- for i, descendant in ipairs(character:GetDescendants()) do
- if descendant:IsA("BasePart") then
- physicsService:SetPartCollisionGroup(descendant, group)
- end
- end
- end
- game.Players.PlayerAdded:Connect(function(player)
- player.CharacterAppearanceLoaded:Connect(function(character)
- -- Check for VIP GamePass
- local success, result = pcall(function()
- return marketplaceService:UserOwnsGamePassAsync(player.UserId, vipId)
- end)
- if not success then print(result) end
- if success and result then
- addToGroup(character, "VIPPlayers")
- end
- -- Check for Premium Cafe Worker GamePass
- local success2, result2 = pcall(function()
- return marketplaceService:UserOwnsGamePassAsync(player.UserId, cafeWorkerId)
- end)
- if not success2 then print(result2) end
- if success2 and result2 then
- addToGroup(character, "CafeWorkers")
- end
- if success and result and success2 and result2 then
- addToGroup(character, "CafeWorkerAndVIP")
- end
- end)
- end)
- local function promptGamepassPurchase(player, id)
- local success, result = pcall(function()
- return marketplaceService:UserOwnsGamePassAsync(player.UserId, id)
- end)
- if not success then print(result) end
- if success and not result then
- marketplaceService:PromptGamePassPurchase(player, id)
- end
- end
- vipDoor.Touched:Connect(function(hit)
- local player = game.Players:GetPlayerFromCharacter(hit.Parent)
- if player then
- promptGamepassPurchase(player, vipId)
- end
- end)
- cafeWorkerDoor.Touched:Connect(function(hit)
- local player = game.Players:GetPlayerFromCharacter(hit.Parent)
- if player then
- promptGamepassPurchase(player, cafeWorkerId)
- end
- end)
- marketplaceService.PromptGamePassPurchaseFinished:Connect(function(player, gamepassId, wasPurchased)
- if gamepassId == vipId then
- if wasPurchased then
- local success, result = pcall(function()
- return marketplaceService:UserOwnsGamePassAsync(player.UserId, cafeWorkerId)
- end)
- if not success then print(result) end
- if success and result then
- addToGroup(player.Character, "CafeWorkerAndVIP")
- else
- addToGroup(player.Character, "VIPPlayers")
- end
- end
- elseif gamepassId == cafeWorkerId then
- if wasPurchased then
- local success, result = pcall(function()
- return marketplaceService:UserOwnsGamePassAsync(player.UserId, vipId)
- end)
- if not success then print(result) end
- if success and result then
- addToGroup(player.Character, "CafeWorkerAndVIP")
- else
- addToGroup(player.Character, "CafeWorkers")
- end
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement