Custom font letters not in right order

I’m trying to make a VHS like game with a timer that shows how long you have been recording/playing the game, but the numbers aren’t in order. I have placed a picture of how it looks like and how it should look like: (the timer on them both is at 3 seconds btw)

How it looks like:
image

How it should look like:
image

Code:

wait(4.75)
function toHMS(seconds)
	return string.format("%02i:%02i:%02i", seconds/60^2, seconds/60%60, seconds%60)
end

function updatetext(updateto,text)
	for i_,v in pairs(text:GetChildren()) do
		if v then
			if not v:IsA("UIListLayout") then
				v:Destroy()
			end
		end
	end
	for count = 1, updateto:len() do
		local l = script:FindFirstChild(text.Name):FindFirstChild(updateto:sub(count, count)):Clone()
		l.Parent = text
	end	
end

local time = 0
local string

while wait(1) do
	string = toHMS(time)
	updatetext(string,script.Parent.Text)
	updatetext(string,script.Parent.Shadow)
	time += 1
end

Explorer if yall need that: (the same things in the text folder are in the shadow folder)
image

1 Like

/: ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎

try changing the LayoutOrder property using your script like this:

wait(4.75)
function toHMS(seconds)
	return string.format("%02i:%02i:%02i", seconds/60^2, seconds/60%60, seconds%60)
end

function updatetext(updateto,text)
	for i_,v in pairs(text:GetChildren()) do
		if v then
			if not v:IsA("UIListLayout") then
				v:Destroy()
			end
		end
	end
	for count = 1, updateto:len() do
		local l = script:FindFirstChild(text.Name):FindFirstChild(updateto:sub(count, count)):Clone()
		l.LayoutOrder = count
		l.Parent = text
	end	
end

local time = 0
local string

while wait(1) do
	string = toHMS(time)
	updatetext(string,script.Parent.Text)
	updatetext(string,script.Parent.Shadow)
	time += 1
end
1 Like

Oh wow that worked! Gosh why does one singular line of code solve my problem most of the time.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.