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.
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.