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

Gamepass checker not working with the code i wrote?

Hi! I'm trying to make a way so when a player owns a gamepass, a frame appears when they join the game. It's so far not working.

This code is in a local script. The script's parent is a frame.

if game:GetService("MarketplaceService"):UserOwnsGamePassAsync
(game.Players.LocalPlayer, 11318343) == true then
	script.Parent.Visible = true
end

the 1st and 2nd lines of code is in one line. When I put them in one line here, it just cut off.

1 answer

✓ Accepted answer

You need to put a userid, not a player instance.

if game:GetService("MarketplaceService"):UserOwnsGamePassAsync
(game.Players.LocalPlayer.UserId, 11318343) == true then
    script.Parent.Visible = true
end

Hope this helps!

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