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 :)
You're correct with how you are writing it, yet it's formatted too weirdly, it confused the Script, try writing it like this?
local Players = game:GetService("Players") local MarketPlaceService = game:GetService(MarketPlaceService") local GamepassId = 5549229 Players.PlayerAdded:Connect(function(Player) --// Connect with a lowercase has been deprecated too, also there shouldn't be a space between the parentheses if (MarketPlaceService:PlayerOwnsAsset(Player, GamepassId)) then Player:WaitForChild("PlayerGui").teleportGUI.Teleport.Visible = true --//It's best to be precautious as the Folder may not load as fast as the Script runs end end)
Hope this fixed your issue