attempt to perform arithmetic on local 'Amount_NeededNM' (a userdata value)?
LocalScript
01 | local LocalPlayer = game.Players.LocalPlayer |
02 | local Assault_Rifle_Ammo = LocalPlayer.Gun_Folder.Ammo_Folder.Assault_Rifle_Ammo.Value |
03 | local Current_Ammo = LocalPlayer.Character:FindFirstChild( "G36" ).Configuration.Ammo.Value |
06 | local Amount_Needed = Max_Ammo - Current_Ammo |
08 | if Assault_Rifle_Ammo > = Amount_Needed then |
10 | local Amount_NeededNM = tonumber (Amount_Needed) |
11 | script.Parent.ReloadAction:FireServer(player,Amount_NeededNM) |
Script
1 | script.Parent.ReloadAction.OnServerEvent:Connect( function (player,Amount_NeededNM) |
2 | local playerammoV = player.Gun_Folder.Ammo_Folder.Assault_Rifle_Ammo.Value |
3 | playerammoV = playerammoV - Amount_NeededNM |
Error
attempt to perform arithmetic on local 'Amount_NeededNM' (a userdata value)
I've attempted this;
-Without using tonumber (same error)
-Using .Value (didn't work since there isn't a .Value to a variable)
Every article I've read regarding something similar to this doesn't output the error stating "arithmetic on local", and "a userdata value".
So I thought I'd resort here, doing everything I could think of, I don't have a clue as to what I need to do.
watch it be just smth so simple to avoid