[v3!] TopbarPlus v3.0.0 | Construct intuitive topbar icons; customise them with themes, dropdowns, captions, labels and much more

Hey i wanted to ask a quick question. Is there a way to make a dropdown icon be selected by default when a player joins a game.

This is the part of the code i want it to be selected by default. I did see a function called :select() however it didnt work for me.

	:setDropdown({
		Icon.new():setLabel("Mr. StrongMan"):bindEvent("selected", function()
			CoreEvent:FireServer("CharacterSelect", "MrStrongMan")
		end);

Would it be possible to add a function to change the console keybind to select the top bar as I have a custom backpack which uses the up on dpad which I can’t really switch.

1 Like

You’re correct, :select() should work for that. Will investigate now :+1:

The default is:

Icon.highlightKey = Enum.KeyCode.DPadUp

to change do:

Icon.highlightKey = Enum.KeyCode.YOUR_KEY

@Duckmancool2285

Thanks for your bug reports! There was a slight quirk in overflows which was triggering an auto deselection of icons which were :selected on startup. This should be fixed now (you can grab the latest copy from the v3 playground).

Is it just my script or doesn’t :give work anymore

icon:give(function(ic)
	local spinner = NumberSpinner.new()
	ic:convertLabelToNumberSpinner(spinner)
	spinner.Duration = 0.25
	spinner.Prefix = ""
	spinner.Suffix = " FPS"
	spinner.Decimals = 0

	local updateCoroutine
	updateCoroutine = coroutine.create(function()
		while true do
			spinner.Value = fps
			fps = 0
			wait(1)
		end
	end)

	coroutine.resume(updateCoroutine)
end)

Can I see all of your code please?

1 Like
local RunService = game:GetService("RunService")
local Icon = require(game:GetService("ReplicatedStorage").TopbarPlus.Icon)
local NumberSpinner = require(game.ReplicatedStorage.NumberSpinner)
local fps = 0

local startTime = os.clock()
local FPS_Counter = 0

local function GetFPS()
	FPS_Counter += 1
	if (os.clock() - startTime) >= 1 then
		fps = math.floor(FPS_Counter / (os.clock() - startTime))
		FPS_Counter = 0
		startTime = os.clock()
	end
end

RunService.Heartbeat:Connect(GetFPS)

local icon = Icon.new()
icon:setLeft()
icon:lock()
--icon:setSize(75, 32)
icon:give(function(ic)
	local spinner = NumberSpinner.new()
	ic:convertLabelToNumberSpinner(spinner)
	spinner.Duration = 0.25
	spinner.Prefix = ""
	spinner.Suffix = " FPS"
	spinner.Decimals = 0

	local updateCoroutine
	updateCoroutine = coroutine.create(function()
		while true do
			spinner.Value = fps
			fps = 0
			wait(1)
		end
	end)

	coroutine.resume(updateCoroutine)
end)

Yeah when I run your code I get this in the output:

It looks like the give method has been removed.

Give me a moment while I try to find an alternative.

1 Like

Yeah exactly i have the same problem but now the question is: how do i fix my problem?

Found (at least part) of the problem.

NumberSpinner support has dropped, and won’t be included in the initial release:

Oh, i didn’t see that! Thanks for the info i will try to look further for a FPS counter without the numberSpinner.

I’ll do my best try and find a workaround. Give me a bit.

Ah alrighty thank you! — 30charc21303030303

1 Like

Alright so I found a solution that allows you to make an icon that displays the FPS, while updating it dynamically.

Explanation:
You’ll need to create an icon and label it with the current fps.

To update it automatically, you’ll detect when the FPS changes and update the label accordingly.

I modified your “GetFPS” script to make it less complicated. All you need to do to get the FPS is use RunService.RenderStepped to get the number of frames a player got in a second.

LocalScript:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RunService = game:GetService("RunService")
local Icon = require(ReplicatedStorage.TopbarPlus.Icon)

local fps = 0

local icon = Icon.new()
icon:setLeft()
icon:lock()
icon:setLabel(`{fps} FPS`)

RunService.RenderStepped:Connect(function()
	fps += 1
end)

while true do // Update every second
	icon:setLabel(`{fps} FPS`)
	frames = 0
	task.wait(1)
end

This will detect and dynamically update the player’s FPS every second and display it on the created icon’s label.

It only counts up, it doesn’t show the actual player fps

@ForeverHD

I’m getting this warning and really intrusive UI on my screen, not sure if it’s from TopbarPlus in relation to the new TextBox update, I could be wrong.

From my testing, it displays the FPS accurately.

(Sorry for the bad quality, it got compressed for some reason)

robloxapp-20240312-1852133.wmv (567.9 KB)
for me it does this

did you modify the localscript in any way? And is the local script located in StarterPlayerScripts?

Also ensure that you’re testing this outside of Studio.