Help with splitting a number

Hello. I am trying to make a GUI that shows the game version. But I want the game version to be separated by dots. Example: Game Version: v2.0.0. Would there be any way of doing this? I just don’t know where to start.

local gameVersion = game.PlaceVersion

local gameVersionTable = gameVersion:split() -- I already know now that this would error because it's not a string

for i=1,#gameVersionTable do
	local newGameVersion = i.."."
	print(newGameVersion)
end

script.Parent.Text = "Game Version: v"..gameVersion

Although this script is the best I could make, I have thought about doing this, I just need a way to split a number.

2 Likes

If you want to split a number, just convert it to a string.

Also if you’re trying split every number, you have to put an empty string in split

local gameVersionTable = tostring(gameVersion):split("") 
2 Likes

Use split(" ") :slight_smile:
:grinning_face_with_smiling_eyes:

1 Like

With a space lol this > split("") means nothing literally

No since that would split the string by every space.

That means it splits every character…

local text = "Text"

for _, v in pairs(text:split("")) do
    print(v)
end

--Output
T
e
x
t

What you said just splits everything that has a space inbetween, what I did splits every character in a character table