this is the script
a = true b = {} c = {} highest = 0 while a == true do wait (1) for _, Player in pairs(game.Players:GetPlayers()) do if Player.DataReady == true then PlayerName = Player.Name local survived=Player:LoadNumber("SurvivedTotal") or 0 table.insert(b,PlayerName) table.insert(c,tostring(survived)) d = 0 for i,v in pairs(c)do d = d+1 wait() if v > highest then highest = v end end script.parent.Text = (b[d]..": "..c[d]) print (c[d]) print (d) d = 0 script.parent.Text = (PlayerName..": "..survived) end d = 0 end b = {} c = {} end
currently it doesent seem to do anything can anyone help?
So from what I can make out, the script above was supposed to pick which player has the highest value while displaying their name along with their score on a TextLabel.
--Script local run = true local highest = nil local highestVal = -1 game.Players.PlayerAdded:connect(function(ply) local leaderstats = Instance.new("IntValue",ply) leaderstats.Name = "leaderstats" local survived = Instance.new("IntValue",leaderstats) survived.Name = "SurvivedTotal" survived.Value = 0 end) while run do wait(1) for i,v in pairs(game.Players:GetChildren()) do local survived = v:FindFirstChild("leaderstats").SurvivedTotal.Value if survived > highestVal then highestVal = survived highest = v end script.Parent.Text = v.Name..": "..tostring(survived) print(survived) print(i) end end