Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Gamepass checker not working with the code i wrote?

Asked by 4 years ago

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

Log in to vote
0
Answered by
Pupppy44 671 Moderation Voter
4 years ago

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!

Ad

Answer this question