I want to add a digit to a textbox/stringvalue. I mean I don't want to do math like 1+1=2 but just get the current number like 1 and add to it 1 so the script would change text value to 11 (Yes, I didn't know the concatenation)
script.Parent.MouseButton1Click:connect(function(buy) local view = script.Parent.Parent.Parent.SUMA.P12.Text if view == 0 then wait(1) -- just nothing elseif view > 0 then -- there i need that function so to add a digit in text wait(1) end end)
Well, I'm new to Lua programming.
What you're trying to do is called concatenation. The concatenation operator in Lua is ..
here's an example of its use:
local str = "Concat" print(str .. "enation") -- Prints "Concatenation"
If my answer solved your problem please don't forget to upvote and accept it!
You could do x * 10 + y, this would effectively add a digit to your value.
function addDigit(x,y) return x * 10 + y end print(addDigit(5,7)) print(addDigit(234,8))
Output:
57
2348