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

Roblox studio says BanGUI is not a valid member but there's an else? [solved]

Asked by 3 years ago
Edited 3 years ago

Whenever I run the script, I keep getting this error:

15:49:13.197 - BanGUI is not a valid member of PlayerGui "Players.AbsurdAwesome101.PlayerGui"

This is the code:

script.Parent.Equipped:Connect(function()
    if lp.PlayerGui.BanGUI ~= nil then
        local gui = lp.PlayerGui.BanGUI
        local frames = gui:GetChildren()
        frames.Visible = true
    else
        script.Parent.BanGUI:Clone().Parent = lp.PlayerGui
    end
end)

this is inside a local script inside a tool. Legit no reason to be giving me errors, so whats wrong????

0
Put if lp.PlayerGui:FindFirstChild("BanGUI") then AntoninFearless 622 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago
Edited 3 years ago

Fixed.

script.Parent.Equipped:Connect(function()
    if lp.PlayerGui:FindFirstChild("BanGUI") ~= nil then
        local gui = lp.PlayerGui.BanGUI
        gui.BanModeToggle.Visible = true
        gui.BreakToggle.Visible = true
    else
        script.Parent.BanGUI:Clone().Parent = lp.PlayerGui
    end
end)
0
Put [Solved] in the title of the question AntoninFearless 622 — 3y
Ad

Answer this question