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?
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.