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

GUI doesn’t support string and variable?

I have a screengui that is supposed display “intermission-30” and so on but when I do

Number = 30
Script.parent.Text = “intermission”Number

It doesn’t work. Is there something I’m missing? EDIT: by it doesn’t work I mean it displays “intermission” but nothing else

3 comments

2

So I would put “Intermission” .. Number. I see. Can you make this an answer? I want to give you reputation when I add it in.

1

Tyvm! ^^

1 answer

✓ Accepted answer

This answer's to be used as a reference

Hello there. :p It's me! :D

The solution to your question's to use concatenation, where the Dev Hub defines it as an "implicit or automatic conversion of a value from one type to another".

Alrighty, I think that's good enough...

WAIT JUST A MOMENT!

Ack, oh no!

Give an example on how to use concatenation!

Ok. ;-;

An example of how to use concatenation's the following;

local HelloStringExample = 'Hello '
local WorldStringExample = 'World!'

print(HelloStringExample .. WorldStringExample) --> Hello World!

When using concatenation, you can even use numbers and booleans;

print('2 + 2 is ' .. 4 .. ' is ' .. tostring(true)) --> 2 + 2 is 4 is true

And that should be it. Right?

Yes.

Yay! :D

Stuff talked about or touched on

  1. Concatenation - Best way I can describe it's that that it combines two or more values together.

  2. Tostring - Converts a value into a string.

  3. Booleans - true/false :p

I recommend using the website's search engine to try and find similar questions by past users.

I hope this helped. :D If you have any questions, feel free to contact me. :)

3 comments

0

I apologize if this answer wasn't explained the best.

1

No its perfect! I liked the way you presented information and summarized it! I wish I could upvote more!

1

Tyvm. :) Means a lot. :D

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