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

How to get players with a gamepass?

Ok so I have a script that prints whether someone entering has a gamepass.

The script uses

local id = 000000

game.Players.PlayerAdded:connect(function(player)
	local GamePassService = game:GetService("MarketplaceService")
	
	local owns = GamePassService:PlayerOwnsAsset(player,id) 
	print(player,'owning the pass is', owns)

So I know that to get the item id of the gamepass you need to go into view page source and use the data-item-id and so thats what i enter.

HOWEVER, when we load into the game, only I print as having the gamepass.

Am I using the wrong number? Doing something wrong here? Please help.

4 comments

0

wdymbt

0

I mean I want to find players that bought the gamepass, but when I try my current method, I am the only one that 'owns the gamepass' when others have bought it.

0

ohk

0

you can try PlayerHasPass method to check if they have pass

2 answers

I've answered a question similar to this You can refer to this for gamepasses

From the other answer, that method won't work for Game Passes, since roblox added a different way to use gamepasses.

ex.

local id = 103728213

game.Players.PlayerAdded:connect(function(player)

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

    print(player.Name .. " has the game pass!")

if game:GetService("GamePassService"):PlayerOwnsAsset(player,id)

print("owned")

else

print("not owned")

end

else

print(player.Name .. " doesn't have the game pass...")

end

end)

5 comments

0

accept this answer pls

0

It doesn't work though

0

try it now and i still helped

0

I've tried this method before, it doesn't work

0

then your gamepass is broken

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