LocalScript
local LocalPlayer = game.Players.LocalPlayer
local Assault_Rifle_Ammo = LocalPlayer.Gun_Folder.Ammo_Folder.Assault_Rifle_Ammo.Value
local Current_Ammo = LocalPlayer.Character:FindFirstChild("G36").Configuration.Ammo.Value
local Max_Ammo = 30
local Amount_Needed = Max_Ammo - Current_Ammo
if Assault_Rifle_Ammo >= Amount_Needed then --(Amount_Needed is already called
reloadAction()
local Amount_NeededNM = tonumber(Amount_Needed)
script.Parent.ReloadAction:FireServer(player,Amount_NeededNM)
end
Script
script.Parent.ReloadAction.OnServerEvent:Connect(function(player,Amount_NeededNM)
local playerammoV = player.Gun_Folder.Ammo_Folder.Assault_Rifle_Ammo.Value
playerammoV = playerammoV - Amount_NeededNM
end)
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

1 comment
Thanks, it worked! Accepted answer.