Cash script giving me twice the money?

So I have this cash script but its giving me twice the money? I have no clue as to why. Any help?

Local

DB = true
local Player = game.Players.LocalPlayer
local Character = Player.Character
local Humanoid = Character:WaitForChild("Humanoid")
local PutAway = Humanoid:LoadAnimation(script:WaitForChild("Animation"))
local Anim = Humanoid:LoadAnimation(script.Parent.IdleAnim)

script.Parent.Equipped:Connect(function()
	Anim:Play()
	end)

script.Parent.Activated:Connect(function()
	if DB == true then
		DB = false
		local val = script.Parent.MoneyValue.Value
script.Parent.GiveMoney:FireServer(val)	
		script.Parent.Handle.AY:Play()
		Anim:Stop()
		PutAway:Play()
		wait(1)
		script.Parent:Destroy()
	end
	end)

	script.Parent.Unequipped:Connect(function()
		Anim:Stop()
		end)

Server

script.Parent.GiveMoney.OnServerEvent:Connect(function(player,val)

player.stats:FindFirstChild("Cash").Value = player.stats:FindFirstChild("Cash").Value + val

end)
1 Like

Theoretically, the remote event fires twice, or it was just a mis-calculation on your side.
But, please take a video of the problem.

Hello. I’ve just replicated this in studio and the event fires just once. Make sure your MoneyValue’s value is the correct number. Try printing val in the local script just after you define this variable as well as printing player.stats:FindFirstChild("Cash").Value before and after changing its value in the server…

So basically, when I was giving myself the money, when going to “remove” the money to put it into the cash value, I would do it locally, big mistake on my part, and it seems to be fixed.