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

Adding string to a StringValue from another string?

Asked by
Qorm 100
9 years ago

So I'm making a password Gui to open a door, and I've come across an issue which I'm completely clueless on how to do. The problem is, I'm trying to add text from a TextButton into a StringValue, but I can't figure out how ANYWHERE.

script.Parent["1"].MouseButton1Click:connect(function(click)
    script.Parent.Value.Value=script.Parent.Value.Value+script.Parent["1"].Text
end)

Yes, it works kind of.. All it does is add a NUMBER to the Value, and if I try to change the text to a String, it says that it can't be placed because It's a "StringValue".. Keep in mind that I'm new at this but help would be greatly appreciated.

1 answer

Log in to vote
2
Answered by
Shawnyg 4330 Trusted Badge of Merit Snack Break Moderation Voter Community Moderator
9 years ago

Well, your thinking was a bit correct, but the way you worded it wasn't good. You have to use concatenation.

script.Parent["1"].MouseButton1Click:connect(function(click)
    script.Parent.Value.Value= script.Parent.Value.Value..script.Parent["1"].Text
end)
0
thank you! Qorm 100 — 9y
0
Glad I could help! Shawnyg 4330 — 9y
Ad

Answer this question