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)
✓ ANSWER ACCEPTED
Why won't this gamepass show the GUI when I go test it out?
2 answers
✓ Accepted answer
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)
1 comment
0
Thanks, I've done what you have told and some reason it not work but it has a red line one line 3 where it say "PromptGamePassPurchaseFinished:Connect" the red line is under the colon.
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
Thank you!