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 7 years ago
01script.Parent.Touched:connect(function(hit)
02 
03   local player = game.Players.LocalPlayer
04   local character = player.Character
05 
06 
07 
08    if hit.Parent then
09        local humanoid = hit.Parent:FindFirstChild("Humanoid")
10        if humanoid then
11 
12     if game:GetService("GamePassService"):PlayerHasPass(player, 1566809186) then
13 
14      print "Teleporting" -- works only if player has game pass
15 
View all 21 lines...

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 7 years ago
Edited 7 years ago

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

1script.Parent.Touched:connect(function(hit)
2    local player = game.Players.LocalPlayer
3    if game:GetService("GamePassService"):PlayerHasPass(player, 1566809186) then
4        print("Teleporting")
5    else
6 
7       game:GetService("MarketplaceService"):PromptPurchase(player, 16630147)
8    end
9end)
Ad

Answer this question