game.ReplicatedStorage.GiveMoney.OnServerEvent:Connect(function() game:GetService("Players"):FindFirstChild(script.Parent.Parent.StarterGui.ControlPlayersGUI.CurrencyController.CashGiver.PlayerName.Text):FindFirstChild("leaderstats"):FindFirstChild("Cash").Value = game:GetService("Players"):FindFirstChild(script.Parent.Parent.StarterGui.ControlPlayersGUI.CurrencyController.CashGiver.PlayerName.Text):FindFirstChild("leaderstats"):FindFirstChild("Cash").Value - tonumber(script.Parent.Parent.StarterGui.ControlPlayersGUI.CurrencyController.CashGiver.Amount.Text) -- The error line end)
Server-Sided script: (Fixed!)
-- Cash script.Parent.GiveCash.OnServerEvent:Connect(function(o, player, amt) game.Players[player].leaderstats.Cash.Value = game.Players[player].leaderstats.Cash.Value + amt end) script.Parent.RemoveCash.OnServerEvent:Connect(function(o, player, amt) game.Players[player].leaderstats.Cash.Value = game.Players[player].leaderstats.Cash.Value - amt end) -- Rebirths script.Parent.GiveRebirths.OnServerEvent:Connect(function(o, player, amt) game.Players[player].leaderstats.Rebirths.Value = game.Players[player].leaderstats.Rebirths.Value + amt end) script.Parent.RemoveRebirths.OnServerEvent:Connect(function(o, player, amt) game.Players[player].leaderstats.Rebirths.Value = game.Players[player].leaderstats.Rebirths.Value - amt end)
Here is the local script for giving cash: (Fixed!)
script.Parent.MouseButton1Click:Connect(function() local player = script.Parent.Parent.PlayerName.Text local cash = script.Parent.Parent.Amount.Text script.Parent.Parent.Parent.GiveCash:FireServer(player,cash) end)