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

Can someone help me with my error? Roblox attempted to perform an arithmetic.. what?..

Asked by 3 years ago

Every time I test my game out, this error pops up: ServerScriptService.Main:13: attempt to perform arithmetic (add) on number and Instance. And I have no idea how to fix this! Here is my script, and I will only be showing the line that has my error.

game.ReplicatedStorage.Remotes.Add.OnServerEvent:Connect(function(player, amount) local currency = 'Cash' player.leaderstats.currency.Value = player.leaderstats.currency.Value + amount end)

Can someone please help me fix this?

1 answer

Log in to vote
0
Answered by 3 years ago

an arithmetic function is just a simple math operation, such as addition, subtraction, multiplication or division.

Your error states that the server is attempting to add a Number value and an Instance. An Instance cannot be added as it isn't a value.

I'd assume 'amount' is the issue, however I can't be sure as I cannot see the rest of your script, just the error line isn't very helpful for fixing errors, as we can't fully get a grasp on the context of the situation we're trying to fix.

Ad

Answer this question