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) ```