Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 4 years ago
Edited 4 years ago

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

0
please give more info about your problem! NSMascot 113 — 4y
0
Don't use an if statement to check if they have the pass, use a variable, and use UserOwnsGamePassAsync instead of PlayerHasPass Robowon1 323 — 4y

1 answer

Log in to vote
0
Answered by
raid6n 2196 Moderation Voter Community Moderator
4 years ago

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)
0
Thanks ZerogameTVCh 17 — 4y
Ad

Answer this question