Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

What's wrong with this code?

Asked by
Sxerks3 65
9 years ago

So, I'm trying to force a Prompt Purchase, if someone doesn't have a gamepass, but if they do, they can access a place. I've finished my code, but it just doesn't want to work.

01service = game:GetService("MarketplaceService")
02teleportService = game:GetService("TeleportService")
03placeID = 11111111
04gamepass = 237848679
05 
06game.Players.PlayerAdded:connect(function(onPlayer)
07    if service:PlayerOwnsAsset(onPlayer, gamepass) then
08        teleportService:Teleport(placeID, onPlayer)
09    else
10        service:PromptPurchase(onPlayer, gamepass)
11    end
12end)
0
Did I have to have the gamepass on the game/place itself for it to work? Sxerks3 65 — 9y

Answer this question