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.

service = game:GetService("MarketplaceService")
teleportService = game:GetService("TeleportService")
placeID = 11111111
gamepass = 237848679

game.Players.PlayerAdded:connect(function(onPlayer)
    if service:PlayerOwnsAsset(onPlayer, gamepass) then
        teleportService:Teleport(placeID, onPlayer)
    else
        service:PromptPurchase(onPlayer, gamepass)
    end
end)
0
Did I have to have the gamepass on the game/place itself for it to work? Sxerks3 65 — 9y

Answer this question