Attempt to perform arithmetic (sub) on boolean and number

  1. What do you want to achieve? Keep it simple and clear!
    Get rid of errors
  2. What is the issue?
    Attempt to perform arithmetic (sub) on boolean and number
  3. What solutions have you tried so far?
    nothing

Module Script:

	game.ReplicatedStorage.Remotes.Bank.OnServerEvent:Connect(function(bType, val)
		if bType == 1 then
			local dift = val - bankValues.Bank -- Problem here
			bankValues.Bank = val
			bankFrame:SetValue("$" .. ShortenNumber(bankValues.Bank), dift)
			bankFrame:SetExactValue("$" .. bankValues.Bank)
		else
			local dift = val - bankValues.Cash -- also too problem here
			bankValues.Cash = val
			cashFrame:SetValue("$" .. ShortenNumber(bankValues.Cash), dift)
			cashFrame:SetExactValue("$" .. bankValues.Cash)
		end
	end)

Module script? Are you sure about that. If so, there’s your problem.

This needs to be run in a serverscript.

but this module script are in StarterPlayerScripts

OnServerEvent gets as a first parameter the player so add that as the first parameter

(player, bType, val)

Hey, you forgot to put the client sender.

game.ReplicatedStorage.Remotes.Bank.OnServerEvent:Connect(function(player, bType, val)

Unless you’ve only shown some of your code, this will not run in a module script.

maybe I could try put coding into server script

Since you’re listening for a server event, this will have to be in a local script.

edit: sleep deprivation is no joke kids

1 Like