How To Substitute Text For Variables?

Hey Developers!

I am trying to use values to fill in some blanks for this project. I haven’t found an answer searching the interwebs, so I thought I’d ask.

Here are the values I plan to reference:
Blanks_To_Fill

ZoneType will be targeting a text label. At the moment, I want to have ZoneName take the values above it (in a ZonePrefix, ZoneIDNumber order) all within its own text label and use it to change the Vz_Unassigned and ZoneName (Ex: Vz34A) break down: ZonePrefix, ZoneIDNumber, ZoneSuffix.

I do know about table.concat and string.format(). Basically those are not hardset (except: ZonePrefix and ZoneSuffix) values, they are customizable based on the user’s needs.

I might be understanding this totally wrong, but, can’t you like just

ZoneName.Text = ZonePrefix.Value .. ", "..  tostring(ZoneIDNumber.Value) .. ", ".. tostringZoneSuffix.Value

(i’m not sure if ZonePrefix and ZoneSuffix are string values)

Yes, ZonePrefix and ZoneSuffix are string values, but as the value ZoneIDNumber states, it is a (Number) IntValue.

Ok I see, and is what I said right? Is that what you were asking for?

If you didn’t use .Value I the definitions, use @starmaq’s method, but just put .Value after each value.

Hope this helped!

Ohh yap sorry I suck sometimes xd

So, I got this far:

ZoneName.Text = ZonePrefix.Value … “, Vz”… tostring(ZoneIDNumber.Value) … ", "… tostring(ZoneSuffix.Value)

I guess the commas threw me off :frowning:

EDIT: After playing around with your solution, I figured it out!

Thank you!

If it worked, make sure to mark the solution! Good job on figuring it out! :smile:

1 Like

Thanks! I recommend checking out more on string manipulation

Thabks a lot for being supportive!

Will do! I sorta have been since I’ve hit that particular road block, any suggested articles?

https://developer.roblox.com/en-us/api-reference/lua-docs/string
This has almost all of the functions you can use on strings, it explains them very briefly sadly, but I’m sure some youtube videos will do