So, I am trying to add text to a textlabel but it gives me the error: attempted to preform arithmetic on field "Text" a string value. Here is the code:
function onClicked() script.Parent.Parent.Parent.Parent.thingy.Text = script.Parent.Parent.Parent.Parent.thingy.Text + "bleh bleh bleh " script.Parent.Parent.Visible = false end script.Parent.MouseButton1Click:connect(onClicked)
You're trying to add a string value. Adding only works with int/number values. You can set the text of the string by simply doing,
function onClicked() script.Parent.Parent.Parent.Parent.thingy.Text = "bleh bleh bleh " --Just make it a string value script.Parent.Parent.Visible = false end script.Parent.MouseButton1Click:connect(onClicked)
If however you wanted to keep the text that's already there and just add new text to the end you would do,
function onClicked() script.Parent.Parent.Parent.Parent.thingy.Text = script.Parent.Parent.Parent.Parent.thingy.Text.."bleh bleh bleh "-- using two dots before the string script.Parent.Parent.Visible = false end script.Parent.MouseButton1Click:connect(onClicked)
If you wanted to add the string to the beginning of the text and keep the rest you would do this,
function onClicked() script.Parent.Parent.Parent.Parent.thingy.Text = "Thanks Wfvj014"..script.Parent.Parent.Parent.Parent.thingy.Text -- string before the value with your "dots" script.Parent.Parent.Visible = false end script.Parent.MouseButton1Click:connect(onClicked)
Hope that helped (:
Good luck!
function onClicked() script.Parent.Parent.Parent.Parent.thingy.Text = script.Parent.Parent.Parent.Parent.thingy.Text.."bleh bleh bleh " script.Parent.Parent.Visible = false end script.Parent.MouseButton1Click:connect(onClicked)