Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to insert a string into another string? {Unanswered}

I need to insert a string in the middle of another string, and I'm not sure how I should go about this. I have a line of code that errors whenever I try to run the script.

local text = ("Pick "..version.."?")

"version" is a string variable. I don't know why this errors, but I would appreciate some help. Thanks!

1 answer

Hmm, try doing it this way;

local version = "1.20.0" --Heres our string
local text = ("Pick "..version.."?") --Heres what it is going to be used in

If this isn't enough, or I didn't do it like you asked, just let me know and I'll fix it. Hope this helped!


-- Edited --

Ok, lets try doing it this way;

local version = "1.20.0" --We have our string, now lets put it to use
local text = ("Pick "..version.."?")
--Now, I'll persume your using this for a 'Message', so lets do this
local Message = Instance.new("Message", game.Workspace) --I just put the Parent as workspace, you can change it if you want to --Makes a new Message and sets its Parent to Workspace
Message.Text = text --The Message is now displaying what the string is 'text is the string being used'

Hope this helped!

1 comment

0

This doesn't help. I said that that line of code erred, but you're still using it here.

This discussion is preserved as it was. New answers, comments, and votes are closed.