Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Can Someone help me fix the problem with my gui that visible when user owns gamepasses?

i spent 2 days on this i tried a lots but it wont worked here my scripts

local id = 6278294
 
game.Players.PlayerAdded:Connect(function(player)
    if game:GetService("GamePassService"):PlayerHasPass(player, id) then
	player.PlayerGui.Pets.TextButton.Frame.Pet1equip.TextButton.Visible = true
end

It worked in studio but it doesn’t work in the real game

Please Help me fix this

2 comments

0

please give more info about your problem!

0

Don't use an if statement to check if they have the pass, use a variable, and use UserOwnsGamePassAsync instead of PlayerHasPass

1 answer

✓ Accepted answer

You haven't gave much information about you're problem. Here's the script anyways.

local id = 6278294
 
game:GetService("MarketplaceService").PromptGamePassPurchaseFinished:Connect(function(plr,ido,purchased)
    if purchased and ido == id then
       player.PlayerGui.Pets.TextButton.Frame.Pet1equip.TextButton.Visible = true 
    end
end)
 
game.Players.PlayerAdded:Connect(function(plr)
    plr.CharacterAdded:connect(function(char)
        if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(game.Players[char.Name].UserId, id) then
            player.PlayerGui.Pets.TextButton.Frame.Pet1equip.TextButton.Visible = true 
        end
    end)
end)

1 comment

0

Thanks

This discussion is preserved as it was. New answers, comments, and votes are closed.