Trying to make a Settings UI with TopBar Plus.
Whenever I add the PlayerGUI as a variable so I can add my folders as a variable so I can get to where my UI is located, my topbar button disappears and my script throws an error because the folder ‘isn’t a valid member of PlayerGui’.
Please help.
Error in output
Script
local Icon = require(game:GetService("ReplicatedStorage").Icon)
local player = game:GetService("Players").LocalPlayer
local playerGui = player.PlayerGui
local MainUIFolder = playerGui.MainUI
local TopBarPlus = MainUIFolder.TopBarPlus
local SettingsUI = TopBarPlus.Settings
local SettingsFrame = TopBarPlus.Settings.Bottom
local icon = Icon.new()
icon:setRight()
icon:setCornerRadius(1, 0)
:setImage(6942070576)
:setLabel("Settings", "hovering")
:setLabel("Close", "selected")
icon:setCaption("Configure settings")
icon:BindToggleItem(SettingsFrame)
icon.deselected:Connect(function()
SettingsFrame.Visible = false
end)
icon.selected:Connect(function()
SettingsFrame.Visible = true
end)