I’m getting the error in the title when I try using this code:
local counter = tostring(0)
counter = counter + amount
local countertext = "count: "..counter
countingTest.Text = countertext
I have tried using the tostring() function to convert the number to text but that still won’t work and the game still counts it as a number so I need help.
I just tested my own code in an empty script, with the result printing, and it works just fine. Did you try it out? Swap the bottom line of my code for print(countertext) and check the output, it works for me.
Edit: Additionally, I tried using your original code using a textlabel and it reproduced the same error, so you’re right that the error is contained to that snippet. Both mine and @SquarePapyrus12’s both worked on the same textlabel.
If you print the counter variable it successfully prints but when I try to change the text itself it won’t update instead it gives me the error in the title that’s the problem.
In your code somewhere the value “Countertext” Is being changed or you haven’t type in the code correctly,
Again, please supply more than just a snippet so we can identify if that’s the case.
local counter = 0
counter = counter + amount
local counterText = "count: ".. tostring(counter)
script.Parent.Text = counterText -- u need to write the whole path, while changing Gui property