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

This probably has a really simple fix and I am just an idiot and I recently started scripting and I have multiple gaps in knowledge. I’m not sure why I am getting this error.

I am trying to add 1 to this number value under a local script in StarterGui after an event has been fired from the server.

The value of the NumberValue is 0. Here is the script:

game.ReplicatedStorage.Cameras.CameraCounter.OnClientEvent:Connect(function()
	script.Value += 1
end)

So yeah, like I said it’s probably something dumb I haven’t done correctly.

1 Like

You’re referring to the .Value property of the script, not the NumberValue.

1 Like

Currently, you are trying to add the value instance, parented to the script, to 1. In order to increase the value by one, you need to do:

game.ReplicatedStorage.Cameras.CameraCounter.OnClientEvent:Connect(function()
	script.Value.Value += 1
end)
2 Likes

Knew it was something dumb, thank you.