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

why wont :PlayHasPass() see if the player has a gamepass?

i have a script that when a player joins it detects if a player has a gamepass. I try to figure out why it doesn't work but nothing works. Why doesn't it work?

game.Players.PlayerAdded:Connect(function(player)
	local value = Instance.new("BoolValue",player)
	value.Name = "HasHazardShow"
	local service = game:GetService("MarketplaceService")
	if service:PlayerOwnsAsset(game.Players[player.Name], 5115790)then
		value.Value = true
	else	
		value.Value = false
	end
end)

2 comments

2

"game.Players[player.Name]". That's redundant

0

True, and use UserOwnsGamePassAsync Gamepasses are no longer assets

1 answer

✓ Accepted answer

You can't do that, the correct function for a gamepass is UserOwnsGamePassAsync since gamepasses are not assets.

 if service:UserOwnsGamePassAsync(player.UserId, 5115790)then

2 comments

1

Thanks, because all the dev wikis and stuff i looked at said to use that.. I guess they need to be updated.

0

I would recommend looking in the actual roblox wiki, they have all deprecated items there.

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