VIP Gamepass GUI Not open's

I am making a VIP pass that Open a Image Button when the Player hast the VIP pass in His inventory,( this Script IS in the Button where you can buy the Button ). I am Not the best scripter, so can anybody anwer me, is the Script working? When not, why IS it Not working ?

local player = game.Players.LocalPlayer

local gamePassID = 1234567 – Ersetzen Sie dies durch die tatsächliche ID Ihres Game Passes

local function onButtonClick()


local hasPass = false
local success, result = pcall(function()
    return game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId, gamePassID)
end)

if success then
    hasPass = result
else
    warn("Fehler beim Überprüfen des Game Pass-Besitzes")
end

if hasPass then
    print("Spieler besitzt den Game Pass bereits.")
else
    game:GetService("MarketplaceService"):PromptGamePassPurchase(player, gamePassID)
end


end

imageButton.MouseButton1Click:Connect(onButtonClick)

local Id = 123456789 --Thats not the real ID, i will Change it later

game.Players.PlayerAdded:Connect(function(Player)
local OwnPass = Player:HasPass(Id)
if OwnPass then

 Player.PlayerGui
end
end) ```
1 Like

Seems like there is an incomplete statement inside the PlayerAdded function?

Try changing it to

Player.PlayerGui.<VIP ScreenGUI name>.Enabled = true
2 Likes

Ok, thankyou i will try it, is that the only thing that is wrong or give it more things i did wrong in the code

1 Like