donateButton.MouseButton1Down:connect(function(donate) if game.Players:FindFirstChild(playerName.Text) then local donatePlayer = playerName.Text if tonumber(donateAmount.Text) ~= nil then if player.leaderstats.Cash.Value >= tonumber(donateAmount.Text) then player.leaderstats.Cash.Value = player.leaderstats.Cash.Value - donateAmount.Text print(donatePlayer) donatePlayer:WaitForChild("leaderstats"):WaitForChild("Cash").Value = donatePlayer.leaderstats.Cash.Value + donateAmount -- ERROR HERE end end end end)
Player2
11:17:10.187 - Players.Player1.PlayerGui.HUD.DonateFrame.DonateScript:32: attempt to call method 'WaitForChild' (a nil value)
11:17:10.188 - Stack Begin
11:17:10.188 - Script 'Players.Player1.PlayerGui.HUD.DonateFrame.DonateScript', Line 32
11:17:10.189 - Stack End
Output says that WaitForChild on a nil value. I have a print(donatePlayer) which prints Player2 but it dosent do the next line saying it cannot WaitForChild as it is apparently a nil value. Anyone got any ideas?