So basically I’ve been working on a button that when clicked, it promts a gamepass purchase. If they own the gamepass then they have access to the Team Change GUI. However, I’ve tried getting the TeamFrame to be visible when the player has the gamepass however it’s not working. I’m pretty sure I need to do something with the PlayerGui I’m just not sure how I do it. I’ve tried WaitForChild but I’m not sure what to do now. Here is the code
local Players = game:GetService("Players") -- Gets the service for players
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local MarketplaceService = game:GetService("MarketplaceService")
local Remote = ReplicatedStorage:WaitForChild("TeamChange")
local GamePassID = 11485810
Remote.OnServerEvent:Connect(function(Player)
local OwnsPass = MarketplaceService:UserOwnsGamePassAsync(Player.UserId,GamePassID)
if OwnsPass then -- User owns gamepass
-- Goal is to make the TeamFrame UI visible
else
MarketplaceService:PromptGamePassPurchase(Player,GamePassID)
end
end)