So I wish to make a timer using images for each number.
Which for the most park works fine as depicted above. However a defect I haven’t been able to sort out properly is turning the tens digit invisible so numbers are displayed as “7” instead of “07”.
local value = workspace.GameValues.CurrentRound.Time -- the timer's value that I want to use for these 3 images
local ni = {
14313419759, --0
14313422119, --1
14313424375, --2
14313427331, --and so forth and so on
14313429470,
14313431377,
14313433374,
14313435059,
14313437440,
14313439722
}
local aux
local function onValueChanged(newValue)
aux = math.floor(value.Value/100%10)
if aux~=0 then
script.Parent.i100.Image = ("rbxassetid://"..ni[aux+1])
else script.Parent.i100.Image = ("rbxassetid://11577778446")
end
aux = math.floor(value.Value/10%10)
if aux~=0 or script.Parent.i100.Image ~= "rbxassetid://11577778446" then
script.Parent.i10.Image = ("rbxassetid://"..ni[aux+1])
else script.Parent.i10.Image = ("rbxassetid://11577778446")
end
script.Parent.i10.Image = ("rbxassetid://"..ni[aux+1])
aux = math.floor(value.Value%10)
script.Parent.i1.Image = ("rbxassetid://"..ni[aux+1])
end
value.Changed:Connect(onValueChanged)
As well as the explorer hierarchy (i1 represents the units, i10 tens and i100 hundreds)
I’ve opted to use images instead of the .Visible purely to lessen the lines of code, the 11577778446 image being an image that got moderated and is thus invisible.
Yet despite it working for the hundreds, the tens digit seems to show as 0 instead of turning invisible.