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

[Solved] Why do I get a userdata error when adding from a function argument?

Asked by 6 years ago
Edited 6 years ago

I'm passing an argument to a function that needs to add the value of the argument. Error: attempt to perform arithmetic on local 'HowMuch' (a userdata value)

Payment:FireServer(player, 15)            --sending the name and amount
replicatedstorage.Payment.OnServerEvent:Connect(function(WhoGets,HowMuch) 
    WhoGets.leaderstats.Money.Value = WhoGets.leaderstats.Money.Value + HowMuch

end)

EDIT: Solved. I forgot the OnServerEvent() returns an additional player argument "hidden" at the beginning before my WhoGets.

Answer this question