Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Money reset script will not reset player money why?

local player = game.Players.LocalPlayer
repeat wait()
until player:FindFirstChild("leaderstats").Money.Value >= 7000000
if player:FindFirstChild("leaderstats").Money.Value >= 7000000 then
	local m = Instance.new("Message")
	m.Text = "Stats Have Been Reset"
	m.Parent = player.PlayerGui
	wait(5)
	m:Destroy()
	player:FindFirstChild("leaderstats").Money.Value = 0
	script.Disabled = true
end

i want this script to reset money if players money is higher then 7 million but this script will now reset players money. please help. this is a local script in playergui. there is a leaderboard in the game which works fine. error: Players.MHaven1.PlayerGui.LocalScript:3 attempt to index a nil value.

2 comments

0

I think you should do repeat wait() until player:FindFirstChild("leaderstats").Money.Value >= 7000000 on one line, but I'm not sure

0

ok

1 answer

✓ Accepted answer
local player = game.Players.LocalPlayer
	while wait() do
	if player:WaitForChild("leaderstats").Money.Value >= 7000000 then
		player:WaitForChild("leaderstats").Money.Value = 0
	    local m = Instance.new("Message")
	    m.Text = "Stats Have Been Reset"
	    m.Parent = player.PlayerGui
	    wait(5)
	    m:Destroy()
        end
end

Try using the above script.

This discussion is preserved as it was. New answers, comments, and votes are closed.