Attempt to perform arithmetic (add) on number and nil

What is

ApplesCollected

Character Limit

Already, check the screenshots and as you can see it works.

1 Like

appleAmount = 15, from server script you can check it (30 crs)…

I meant to say
applesCollected

sorry

You don’t return in the addApple function so it returns just nil

1 Like

True this might be the issue good eye

I don’t think it’s the problem of applesCollected since the print works the same, all values and etc, the thing is I can’t get how to add or do - from modules, since if I just use plr.Apples.Value = module.addApple(15,appleValue) it works without any errors which is weird.

Try what @UnknownParabellum said try returning the apple value (or apples collected)

I tried do it also, still the same error which is insane.

Mb, didn’t see that

Could it be possible that you may be creating the Values on the client instead? And the server wouldn’t be unable to detect them that way perhaps?

I never would do this weird mistake. Everything is based of module and server side only.

Do you still get the error if you call the module like this:

module.addApple(appleAmount, 15)

It will be the diff error such as: Number can’t get value(that’s why I said before the module checking everything and it can’t be the issue)

I dont think you have to have this line of code if appleAmount ~= nil and appleValue ~= nil then

What if you try removing the .Value from this:

local remainingApple = appleValue.Value + appleValue

And just call the module with: module.addApple(appleAmount, appleValue.Value)

It’s in the same time funny and makes me confused, if I just do for example:

plr.Apples.Value = module.addApple(15, appleValue) ITS WORKS but then how it will add the X value?

So then we should do: plr.Apples.Value += but if we do it then the error appears.

It’s checking if I forgot to add something then it will print me ‘appleAmount nil’ or ‘appleValue = nil’

What are you using AppleAmont for as your adding appleValue.Value with appleValue

Here:

local remainingApple = appleValue.Value + appleValue

Still the same error, so I believe is module script works pretty good and it can’t make any issue which is makes me sick, so the mainly problem is on server side and I don’t know what’s wrong with it.

Not sure what else the issue could be then

A place file to reproduce it could be helpful, otherwise I’m unsure on where the error may lie