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

how to fix "attempt to perform arithmetic (add) on string"?

Asked by 2 years ago

I'm trying to create one of those "input code" thingies when i got this error that says "attempt to perform arithmetic (add) on string"

how do i fix this?

heres the code:

local frame = script.Parent.Parent
local teckst = script.Parent.Text

function onButtonActivated()
    frame.PWInput.Text = (frame.PWInput.Text + teckst)
end

script.Parent.Activated:Connect(onButtonActivated)

1 answer

Log in to vote
0
Answered by 2 years ago
Edited 2 years ago

Please provide explanation with your answers. Simply posting code does not spread knowledge of integral scripting processes which helps people understand the logic and reasoning behind your answer.

you have to do like so:


local frame = script.Parent.Parent local teckst = script.Parent.Text function onButtonActivated() frame.PWInput.Text = (frame.PWInput.Text .. teckst) -- replace + with two dots end script.Parent.Activated:Connect(onButtonActivated)
0
ok i fix the answer R_LabradorRetriever 198 — 2y
0
Thank you for this answer! jdhidijdjdj 2 — 2y
Ad

Answer this question