What solutions have you tried so far? Did you look for solutions on the Developer Hub?
Nothing, don’t see where the issue is located exactly.
Script where line 77 is located:
local API = {}
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Assets = require(ReplicatedStorage.Databases.Assets)
local Constants = require(ReplicatedStorage.Databases.Constants)
local bankValues = {Bank = 0, Cash = 0}
local ValueBox = {}
ValueBox.__index = ValueBox
local bankFrame = ValueBox.new(Assets.IconRect.Bank)
local cashFrame = ValueBox.new(Assets.IconRect.Cash)
local RemoteHandler = require(script.Parent.RemoteHandler)
local updateRemote = RemoteHandler.Event.new("BankUpdate")
local RoundNumber = function(num, numDecimalPlaces)
return string.format("%." .. (numDecimalPlaces or 0) .. "f", num)
end
local function ShortenNumber(num)
return math.abs(num) > 999 and RoundNumber(num / 1000, 1) .. "k" or num
end
updateRemote.OnEvent:Connect(function(bType, val)
if bType == 1 then
local diff = val - bankValues.Bank
bankValues.Bank = val
bankFrame:SetValue("$" .. ShortenNumber(bankValues.Bank), diff)
bankFrame:SetExactValue("$" .. bankValues.Bank)
else
local diff = val - bankValues.Cash
bankValues.Cash = val
cashFrame:SetValue("$" .. ShortenNumber(bankValues.Cash), diff)
cashFrame:SetExactValue("$" .. bankValues.Cash)
end
end)
local function getStat(val)
if val == "Bank" then
return bankValues.Bank
elseif val == "Cash" then
return bankValues.Cash
end
end
The only subtraction I see taking place is in the if statement so check both values and make sure their the correct inputs by placing a print statement just before subtracting them to see whats being put in.
Val is a boolean and not a number so it’s not subtractable, what is val supposed to be? Check where its defined or passed in and make sure its a number and not a string bc I see from that function it’s a string (which can’t be subtracted).
Check where the values being passed in and make sure the correct value is assigned to val because right now it’s a non numeric value so they can’t be subtracted.
Not there either. In a function the value passed in as an argument would look something like this.
local val = 5 -- Variable 'val' is defined.
function printVal(val) -- Function printVal.
print(val)
end
printVal(val) -- Function printVal is ran with the variable passed in as an argument.