Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Game pass not working if player doesnt have game pass?

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

✓ Accepted answer

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)

This discussion is preserved as it was. New answers, comments, and votes are closed.