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

Attempt to perform arithmetic (add) on Instance and number?

Hello, I am making customization for my RC car game. But the more power button doesn't work. I get the error Attempt to perform arithmetic (add) on Instance and number. I don't know what that means?

local speed = game.ServerStorage.ElectricPower
script.Parent.ClickDetector.MouseClick:connect(function(player)
	speed.Value = speed + 1
end)

1 comment

0

Can you expand a bit more is electric power a int value etc can you give more detail bc the persons answer is right

1 answer

✓ Accepted answer
local speed = game.ServerStorage.ElectricPower
script.Parent.ClickDetector.MouseClick:connect(function(player)
    speed.Value = speed.Value + 1
end)

speed.Value = speed + 1 it seems like you forgot to add .Value again. very common scripting mistake

2 comments

0

But now I am getting 08:17:52.723 - Workspace.Part.BillboardGui.Text.Script:3: attempt to concatenate Instance with string

0

If you are using a StringValue, use a NumberValue Instead.

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