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

How Can I Fix "AdminGUI is not a valid member of PlayerGui"?

Asked by 4 years ago

Im Making Admin For My Game And When You Click On The Admin Button If You Own The gamepass It will Show a gui but its giving me an error Here Is My Script

local passId = 13118751
local player = game.Players.LocalPlayer
local gui = game.Players.LocalPlayer.PlayerGui.AdminGUI

script.Parent.MouseButton1Click:Connect(function()
    if game:GetService("MarketplaceService"):PlayerOwnsAsset(game.Players.LocalPlayer.UserId, passId) then 
        gui.Enabled = true
    else
        game:GetService("MarketplaceService"):PromptGamePassPurchase(game.Players.LocalPlayer, passId)
    end
end)

And The Console Says: AdminGUI is not a valid member of PlayerGui "Players.fgtv2222222222222222.PlayerGui"

0
Assets do not load immediately, use :WaitForChild("AdminGui") instead. Ziffixture 6913 — 4y
0
Where is your script located? also do, local gui = game.Players.LocalPlayer.PlayerGui:WaitForChild("AdminGUI") ninjabryan43 0 — 4y
0
@ninjabyan43 the script is located in game.startergui.admb.localscript fgtv2222222222222222 14 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

Use

local gui = game.Players.LocalPlayer.PlayerGui:WaitForChild("AdminGUI")
Ad

Answer this question