local player = game.Players.LocalPlayer

local Character = player.Character

if Money == nil then

Money = 50

end

local hum = Character:WaitForChild("Humanoid")

  

  

hum.Died:Connect(function()

if Money > 10 then

local Drop = math.random(5, 15)

print(Drop)

Money = Money - Drop

print(Money)

end

end)

  

while wait(1) do

print(Money)

end

The script works until the humanoid dies, then the money resets to 50. How would I make it so it stays on the value it was left on?

2 comments

0

U need a wait(6) right under the hum.Died

0

Is this script in the StarterCharacterScripts by any chance?