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)