I just want to make a script where a gui is visible when a player owns a gamepass. Also my game is filtering enabled and this is a local script.
local id = 4894476
local player = game.Players.LocalPlayer
if game:GetService("MarketplaceService"):PlayerOwnsAsset(player, id) then
script.Parent.Visible = true
else
script.Parent.Visible = false
end
Can someone please help me figure out what is wrong?
Thank you.

2 comments
Do if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId, id) then
Thanks I will try that.