How can i detect if player has gamepass? (not LocalPlayer)

I want to detect if player has gamepass. (I’m making gamepass gift system)
I’m using marketPlaceService:UserOwnsGamepassAsync (In local script)

i tried to detect other players but it doesnt work with an error “UserOwnsGamePass can be only called with localplayer”.

Everything works well except this problem.

Sample code :

local mps = game:GetService("MarketPlaceService")
if mps:UserOwnsGamePassAsync(playerID, gamepassID) == true then

You are doing it in local or server script? And please show full script

1 Like

See this line
I’m using marketPlaceService:UserOwnsGamepassAsync (In local script)

:UserOwnsGamepassAsync() only accepts one player’s userid at a time. Plus I’m pretty sure you can use this in a serverscript:

    if MarketPlaceService:UserOwnsGamepassAsync(Player.UserId, GamepassID) then
1 Like

As AustinBlox said, you need PlayerID

1 Like

I can use marketPlaceService in server script service?


Ye you need 1 player id and it has to be in a server script


Yes. You can use it in serverscriptservice.

Oh, then i will try it in server script service using fireserver.
Thanks very much

1 Like

You wouldn’t need to use any remote events because this is checking if the local player has the gamepass through a server-script.

Hope the code I have displayed helps.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.