Why doesnt this work

Hello so i got this script

local martket = game:GetService("MarketplaceService")

game.Players.PlayerAdded:Connect(function(player)
	if martket:UserOwnsGamePassAsync(player.UserId, 1654145049) then
		print(player.Name)
	end
end)

and it doesn’t print anything. why?

1 Like

maybe because the “player” that it’s checking for doesn’t have the gamepass?

Maybe You Dont Own The GamePass?

How do i not own it when i created it???

just make an else and see if it prints something there

That What I Think That Does Not Own The GamePass

Alright nevermind. i put it inside starterplayer instead of serverscriptservice.

Place this script in ServerScriptService, if you do not own it, it wont print it.

Just add a else to confirm this.

local MarketplaceService = game:GetService("MarketplaceService")

game.Players.PlayerAdded:Connect(function(player)
if MarketplaceService:UserOwnsGamePassAsync(player.UserId, 1654145049) then
print(player.Name, "owns this gamepass")
else
print(player.Name, "does not own this gamepass")
end
end)