Hi, i'm trying to write a script that makes a TextBox's text say a message followed by a variable.
I've tried loads of different ways to write what seems like the same thing.
1 | local p = script.Parent.Parent.CarName |
2 |
3 | while true do |
4 | wait() |
5 | script.Parent.Text = (( "Welcome into this " )..(p)) |
6 | end |
also tried:
1 | local p = script.Parent.Parent.CarName |
2 |
3 | while true do |
4 | wait() |
5 | script.Parent.Text = "Welcome into this " ..p |
6 | end |
and:
1 | local p = script.Parent.Parent.CarName |
2 |
3 | while true do |
4 | wait() |
5 | script.Parent.Text = ( "Welcome into this " ..p) |
6 | end |
Should be easy.... any help?
I believe your variable is incorrect. I do not know if CarName is something inside of your game, but assume you meant CarName , then you need to direct the script to the name of this so it may add it to your script.
1 | local p = script.Parent.Parent.CarName.Name |
2 |
3 | while true do |
4 | wait() |
5 | script.Parent.Text = "Welcome into this " ..p |
6 | end |
If you actually mean Car and Name should have had a period in front, then:
1 | local p = script.Parent.Parent.Car.Name |
2 |
3 | while true do |
4 | wait() |
5 | script.Parent.Text = "Welcome into this " ..p |
6 | end |
Future reference:
You don't need a parenthesis around your string. just doing script.Parent.Text = "Welcome into this "..p
will work. I believe parenthesis work as well, although I do not use them for what you're doing.