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

The error is 'attempt to perform arithmetic (add) on string'?

local text = script.Parent.Parent.ComputerScreen.SurfaceGui.TextLabel
script.Parent.ClickDetector.MouseClick:Connect(function()
	text.Text = text.Text + "H"
end)

this is my script. I dont know whats wrong.

1 answer

✓ Accepted answer

You cannot add a string and string, only number and a number, instead use this:

text.Text = text.Text.."H"

How it works: Ever time to click, it will change the text to the text, but with an added letter.

Example: The text is "H", after clicking, it will become, "HH"

Backspace:

if #text.Text >= 1 then
    script.Parent.Text = script.Parent.Text:sub(1, (#text.Text - 1))
end

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