Hello Develepers, i have a Problem in one of my games, i tryed to make a Script that make a Imagebutton visible, when the Player hast a specific Gamepass. The Image Button is in a frame in the screenGUI ( screenGUI IS in the starterGUI ). But every time i try to Script IT, Something IS not working
I Made the Script in a localscript in the screenGUI in the starterGUI, i have Made a imagelabel named: GirlVIP
Tere IS the Script:
local imageButton = script.Parent:WaitForChild("GirlVIP") -- Referenz zum ImageButton
local gamePassId = 123456789 -- i will soon Change IT to the real ID
local player = game.Players.LocalPlayer
local playerId = player.UserId
local function hasGamePass(playerId, gamePassId)
local success, result = pcall(function()
return game:GetService("MarketplaceService"):UserOwnsGamePassAsync(playerId, gamePassId)
end)
if success then
return result
else
warn("Fehler bei der Überprüfung des GamePass-Besitzes: " .. tostring(result))
return false
end
end
if hasGamePass(playerId, gamePassId) then
imageButton.Visible = true
else
imageButton.Visible = false
end
local Mps = game:GetService("MarketplaceService")
local imageButton = script.Parent:WaitForChild("GirlVIP") -- Referenz zum ImageButton
local gamePassId = 123456789 -- i will soon Change IT to the real ID
local player = game.Players.LocalPlayer
local playerId = player.UserId
local function hasGamePass(playerId, gamePassId)
local HasGamePass = Mps:UserOwnsGamePassAsync(playerId, gamePassId)
return HasGamePass
end
if hasGamePass(playerId, gamePassId) then
imageButton.Visible = true
else
imageButton.Visible = false
end
could you specify the problem, you’ve told us that something is wrong with the script causing it to not work, but you havent told us what specifically is happening / not happening
giving us any errors that are showing up will also help