Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by
RedCombee 585 Moderation Voter
9 years ago

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

Log in to vote
-1
Answered by 9 years ago

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!

0
This doesn't help. I said that that line of code erred, but you're still using it here. RedCombee 585 — 9y
Ad

Answer this question