local id = 6625946 game:GetService("MarketplaceService"):PromptGamePassPurchaseFinished:Connect(function,ido,purchase) if purchase and ido == id then game.StarterGui.TestGui.TextButton.Visible = true end) game.Players.PlayerAdded:Connect(function(plr) if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(plr.UserId,id)then game.StarterGui.TestGui.TextButton.Visible = true end end)
StarterGui is a service that clones anything into it into the "PlayerGui" of a player. Instead, we'll make the script a client side script in the GUI itself.
local id = 6625946 local Player = game:GetService("Players").LocalPlayer local MarketPlaceService = game:GetService("MarketplaceService") local UserOwnsPass = MarketPlaceService:UserOwnsGamePassAsync(Player.UserId,id) if UserOwnsPass then print("Success!") script.Parent.TextButton.Visible = true end
Hello.
You are changing the TextButton Visible property on the server. (game.StarterGui.TestGui.TextButton
).
To make it work, you have to change it in the PlayerGui
. For example:
game.Players.PlayerAdded:Connect(function(player) if yourcondition then player:WaitForChild("PlayerGui").TestGui.TextButton.Visible = true end end)