This is because you have put your code in a PlayerAdded function but since this is a localscript, the player has already joined the game. Removing game.Players.PlayerAdded:Connect(function(player) and the accompanying end) will fix it.
Now it works, thanks for the help. Didn’t realize that could happen so thank you.
I’m currently having a tiny issue where the frame won’t appear even though its visible?
local player = game:GetService("Players").LocalPlayer
local playerGui = player.PlayerGui
local replicatedStorage = game:GetService("ReplicatedStorage")
local iconModule = replicatedStorage.Icon
local Icon = require(iconModule)
local IconController = require(iconModule.IconController)
local Themes = require(iconModule.Themes)
local adminMenu = game.StarterGui.AdminGui
local adminFrame = game.StarterGui.AdminGui.Frame
local playerUI = player:FindFirstChild("PlayerGui")
local canViewIcon = false
if player:GetRankInGroup(10565031) > 6 then
canViewIcon = true
end
Icon.new()
:setEnabled(canViewIcon)
:setName("AdminPanel")
:setImage(7072721855)
:setLabel("Admin Panel")
:bindEvent("selected", function()
playerUI.AdminGui.Frame.Visible = true
adminFrame.AnchorPoint = Vector2.new(0, 0)
adminFrame.Position = UDim2.new(1.1, 0, 0.178, 0)
wait(0.5)
adminFrame:TweenPosition(UDim2.new(0.83, 0, 0.178, 0))
end)
:bindEvent("deselected", function()
adminFrame.AnchorPoint = Vector2.new(0, 0)
adminFrame.Position = UDim2.new(0.83, 0, 0.178, 0)
wait(0.5)
adminFrame:TweenPosition(UDim2.new(1.1, 0, 0.178, 0))
end)
Are you sure the ScreenGUI is enabled?
Is there a option to change the font of a label?
You can achieve this by customising iconFont
within your theme (learn more about themes here):
Or alternatively by modifying the setting of an individual icon:
icon:set("iconFont", Enum.Font.GothamSemibold)
Could exploiters potentially use :BindEvent
as a backdoor to the serverside? Can exploiters use the module themselves? Is there any protection from them?
icon:bindEvent
simply connects a function to a given signal. Everything is client-sided so there’s nothing (such as remotes) to be exploited.
Anyone know why this isn’t auto scaling the TextLabel to the new string?
local Queue = Icon.new()
:setImage(4400704299, "deselected")
:setImage(3944680095, "selected")
:setLabel("Join Queue", "deselected")
:setLabel("Waiting for available server..", "selected")
:setSize(45)
:setTopPadding(8)
:setMid()
Curious but if anyone knows how to autoscale it, let me know! Thanks in advance : )
Calling setSize
before setLabel
should do the trick:
local Queue = Icon.new()
:setImage(4400704299, "deselected")
:setImage(3944680095, "selected")
:setSize(45)
:setLabel("Join Queue", "deselected")
:setLabel("Waiting for available server..", "selected")
:setTopPadding(8)
:setMid()
(this is because calling setSize after setLabel causes the icon to shrink back to an X width of 45)
Hey, so say I have this hierarchy:
- Button called Potato that can be toggled on/off
- Button with drop down called carrot
- Random bobux button
- Button called tix that opens up a horizontal menu
- Button called noob that can be toggled
Now when I go toggle “potato” on, then go toggle “noob” on THEN off, all three buttons, “Potato”, “Noob” and “carrot” are now deselected
Any way I can make it so that doesn’t happen? I’d like to only deselect noob without causing the others to be deselected.
Hey, this should be as simple as setting deselectWhenOtherIconSelected to false
for all your desired icons (dropdowns and menus automatically apply this to their icon). More info here:
Hey @ForeverHD So im still having troubles with this one part, where Im using a DANCE GUI.
If I set the GUI to “ResetonSpawn” to FALSE then it will stop working.
But that means it stops working after reset for the TOPBAR.
I tried your way -
local icons = Icon.IconController:getIcons()
for _, icon in pairs(icons) do
Icon.IconController:clearIconOnSpawn(icon)
end
But im getting the message “index nil with getIcons”
any idea?
Howdy, :clearIconOnSpawn should only be used when your GUI’s ResetOnSpawn is true
. If you’ve set your value to false you shouldn’t need to do anything else (ensuring your LocalScript is located within that particular GUI or StarterPlayerscripts).
Hey @ForeverHD u can add to topbar+ “models frame” can rotate, etc u put a model and u view it like a image but the model rotate!, its a suggestion. i dont need use it!
A little nitpicky, but it would be nice if there was a better indication that the module was required on the server.
Instead of this error: Icon.TopbarPlusGui:335: attempt to index nil with 'PlayerGui'
.
Took me some time to realize what exactly was going on.
Like ViewportFrames? Sure we can consider that.
Do you mean required on the client? It shouldn’t be required on the server. We do have this message at the very top of the docs although can certainly look at creating a dedicated notice box to make it more visible:
If not, could you explain further what you mean?
I was using a configuration module that is shared between the client and the server.
For some reason I decided to place references to icons inside of it (for the client to access), and I got that rather confusing error.
It’s a small thing but it would be handy if the module detected internally if it is being required by the server RunService:IsServer()
, and if it would use error("Topbarplus can only be required by the client!")
to alert the user.
It’s a small thing but doing this can save some time to users that (ab)use the system .
Absolute time-saver. Huge thanks for creating this module, I’ll definitely be using it in the future. Wish I would have found it sooner.
One thing I noticed was when messing around with the 3rd Party NumberSpinnerModule by boatbomber, after using the convertLabelToNumberSpinner() function, any change to the value of the topBar label (Now a Number Spinner) no longer resized the label to an appropriate size. It was also set too far to the right in most cases. This left the frame constantly too big or too small. Obviously I could have setSize() the frame and gotten it to size properly but I wasn’t sure what exact calculations you had done to determine the proper pixel/offset values. Ultimately I wasn’t planning on using the NumberSpinner in the topBar, just messing around with it, but if someone were to they might struggle with the same issue.
It’s also very possible I just used the function wrong so if that’s the case feel free to let me know.