Am I doing something wrong? it should only show 1 and not 3.
local TopbarService = require(game:GetService("ReplicatedStorage").TopbarPlus)
local Map = workspace:WaitForChild("Map")
local LapsIcon = TopbarService.new()
LapsIcon:setRight()
--LapsIcon:setSize(100, 32)
LapsIcon:lock()
LapsIcon:setImage("rbxassetid://6295541655")
LapsIcon:setLabel("1/1")
local MaxLaps = Map:GetAttribute("MaxLaps")
local Lap = 1
LapsIcon:setLabel("1/"..MaxLaps)
local function AddLap()
Lap += 1
LapsIcon:setLabel(Lap.."/"..MaxLaps)
end
game:GetService("ReplicatedStorage").AddPlrLap.OnClientEvent:Connect(AddLap)
game:GetService("ReplicatedStorage").FinalLap.OnClientEvent:Connect(AddLap)
I put it inside a folder in the PlayerGui, and then I put it inside a ScreenGui. They both did the same thing. I inserted the module just before I scripted my lap counter. I currently don’t have access to Studio.
Hi again.
I want to create a timer and found this awesome module: NumberSpinner Module.
Would it be possible to use this as a timer like in the example place?
In other words: is it possible to wrap an icon around the frame that is returned from the module?
That’s not possible at this stage in time as some internal workings would have to be modified. I’d recommend submitting a feature request for that at the repository (although I couldn’t guarantee it being completed anytime soon).
I’ve been experiencing 2 problems with this module. With update v2.5.1 I’ve been experiencing clipping issues on some of the letters after this latest update. (Ex. G, Y) (Image attached below) Newest update [v2.5.1]
Older update
The second problem I have is if edit the text of an button and the new text had more letters than the original one it would have a ton of space in between. [See example below]
Button with alot of letters Lets call this button A.
Button B Text is shorter than button A although the button size itself stays the same.
Code
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 Hi = replicatedStorage:FindFirstChild("MusicTitle")
-- Apply BlueGradient Theme
IconController.setGameTheme(Themes.BlueGradient)
local Ye = Icon.new()
:setLabel('Song: ' .. Hi.Value)
:setOrder(3)
:bindEvent("selected", function()
print("selected!")
end)
:bindEvent("deselected", function()
print("deselected!")
end)
Hi.Changed:Connect(function()
Ye:setLabel("Song".. Hi.Value)
end)
Apart from that as of right now I’ve been experiencing no issues; Thanks for making a great module!
Thanks for the report, I’ve opened up a ticket which I’ll aim to complete for sometime this week:
Are you still experiencing this issue in v2.5.1? This bug should have been patched for that. If so, can you provide more example code which reproduces that bug. Thanks!
Ok i still don’t know how to uses it. Is it something like this?
local Icon = require(game:GetService("ReplicatedStorage").Icon)
Icon.new()
:setLabel("FPS")
:setCaption("FPS")
local RunService = game:GetService("RunService")
local FpsLabel = icon:setLabel(tostring())
local TimeFunction = RunService:IsRunning() and time or os.clock
local LastIteration, Start
local FrameUpdateTable = {}
local function HeartbeatUpdate()
LastIteration = TimeFunction()
for Index = #FrameUpdateTable, 1, -1 do
FrameUpdateTable[Index + 1] = FrameUpdateTable[Index] >= LastIteration - 1 and FrameUpdateTable[Index] or nil
end
FrameUpdateTable[1] = LastIteration
FpsLabel.Text = tostring(math.floor(TimeFunction() - Start >= 1 and #FrameUpdateTable or #FrameUpdateTable / (TimeFunction() - Start))) .. " FPS"
end
Start = TimeFunction()
RunService.Heartbeat:Connect(HeartbeatUpdate)
local UPDATE_LABEL_COOLDOWN = 0.1
local runService = game:GetService("RunService")
local replicatedStorage = game:GetService("ReplicatedStorage")
local timeFunction = runService:IsRunning() and time or os.clock
local Icon = require(replicatedStorage.Icon)
local fpsIcon = Icon.new()
local nextLabelUpdate = 0
local lastIteration, start
local frameUpdateTable = {}
start = timeFunction()
runService.Heartbeat:Connect(function()
lastIteration = timeFunction()
for Index = #frameUpdateTable, 1, -1 do
frameUpdateTable[Index + 1] = frameUpdateTable[Index] >= lastIteration - 1 and frameUpdateTable[Index] or nil
end
frameUpdateTable[1] = lastIteration
local labelText = tostring(math.floor(timeFunction() - start >= 1 and #frameUpdateTable or #frameUpdateTable / (timeFunction() - start))) .. " FPS"
if lastIteration >= nextLabelUpdate then
nextLabelUpdate = lastIteration + UPDATE_LABEL_COOLDOWN
fpsIcon:setLabel(labelText)
end
end)
I recommend checking out the Introduction and Features pages to understand what each icon method does: