So i'm making a game and i'm trying to make a teleport button only show up when the player owns a gamepass. I'm very new to scripting and the only tutorial out there for it is one from over a year ago. I tried changing it to work with MarketPlaceService but with no luck.
Here is the script if anyone is able to fix it.
local id = 5549229
game.Players.PlayerAdded:connect(function (plr)
if game:GetService('MarketplaceService'):PlayerOwnsAsset(plr,id)then
plr.PlayerGui.teleportGUI.Teleport.Visible = true
end
end)
Thanks :)

1 comment
you could change it up a bit and have it so that the gui is enabled by default and store it in server storage and then when a player joins the game check if they have the game pass, and if they do, add the gui to their screen.