I Have A Gamepass In My Game But When Someone Touches The Part To Purchase The Gamepass The Server Prompts Everybody In The Game To Purchase The Gamepass But When The Users Click the “Cancel” Button The Game Gives The Users The Item Just Like They Clicked The Purchase Button Here Is My Script:
local player = game.Players.LocalPlayer
local gamepassid = 50179266
local door = game.Workspace.VIPRoom.VIPMessage
local mps = game:GetService('MarketplaceService')
local function gamepass(...)
game:GetService('MarketplaceService'):UserOwnsGamePassAsync(player.UserId, gamepassid)
door.CanCollide = false
print('Prompt Gamepass Finished', ...)
end
local button = game.Workspace.VIPRoomPurchase
local function purchase(...)
if button.Touched then
if mps:UserOwnsGamePassAsync(player.UserId, gamepassid) == true then
print('User Already Owns GamePass!')
else
local mps = game:GetService('MarketplaceService')
mps:PromptGamePassPurchase(player, gamepassid)
mps.PromptGamePassPurchaseFinished:Connect(gamepass)
end
end
end
button.Touched:Connect(purchase)
Thanks, Sorry If This Is Confusing.