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

Game pass not working if player doesnt have game pass?

Asked by 6 years ago
script.Parent.Touched:connect(function(hit)

   local player = game.Players.LocalPlayer
   local character = player.Character



    if hit.Parent then
        local humanoid = hit.Parent:FindFirstChild("Humanoid")
        if humanoid then

     if game:GetService("GamePassService"):PlayerHasPass(player, 1566809186) then 

      print "Teleporting" -- works only if player has game pass

else 
    game:GetService("MarketplaceService"):PromptPurchase(player, 16630147)
end
        end
    end
    end)

I want to sell game pass to player if they dont have it but nothing happens. - Thanks

1 answer

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

You have a lot of random rubbish here, lemme clean it up a lil bit.

script.Parent.Touched:connect(function(hit)
    local player = game.Players.LocalPlayer
    if game:GetService("GamePassService"):PlayerHasPass(player, 1566809186) then 
        print("Teleporting")
    else

       game:GetService("MarketplaceService"):PromptPurchase(player, 16630147)
    end
end)
Ad

Answer this question