I got a script where it shows the top player with most survives:
local ds = DataStore:GetDataStore("MostWinsGlobalStats")
game.Players.ChildAdded:connect(function(player)
wait(5)
local leaderstats = player:FindFirstChild("leaderstats")
if leaderstats then
local Survivals = leaderstats:FindFirstChild("Survivals")
if Survivals then
local laststats = ds:GetAsync("MostSurvivals") or 0
local lastname = ds:GetAsync("UserName") or "No Stats yet"
if Survivals.Value >= laststats then
ds:SetAsync("MostSurvivals",Survivals.Value)
ds:SetAsync("UserName",player.Name)
end
Survivals.Changed:connect(function()
local leaderstats = player:FindFirstChild("leaderstats")
if leaderstats then
local Survivals = leaderstats:FindFirstChild("Survivals")
if Survivals then
local laststats = ds:GetAsync("MostSurvivals") or 0
local lastname = ds:GetAsync("UserName") or "No Stats yet"
if Survivals.Value >= laststats then
ds:SetAsync("MostSurvivals",Survivals.Value)
ds:SetAsync("UserName",player.Name)
end
end
end
end)
end
end
end)
while true do
game.Lighting.WithMostWins.Value = ds:GetAsync("UserName") or "No Stats yet"
game.Lighting.MostWInsValue.Value = ds:GetAsync("MostSurvivals") or 0
wait(1)
end
But sometimes i want to test stuff of high survivals value (Rewards) and maybe i will get on top #1 from getting those stats. So i want to add a line code that if there’s a player with the highest survivals, i can write in that code that he cant be at the leaderboard. I hope you can help me, thanks!
Basically, you want to hide the player with most survivals from leaderboard?
If you do, I think that before this long code you should put an if statement, and if the player doesn’t have the most survivals, code will be executed.
Sorry for being completely off-topic here, but your current code is a large mess and you’re going to experience some major data throttling. Keep in mind DataStore Limitations when working with DataStores: you don’t have the luxury to make all the calls in the world. Points of error:
Using two GetAsync requests per 1 second
Using DataStores at all with a Changed event
Two GetAsync requests every change and initial setup
Two SetAsync requests every time the new value is greater than the previous
As for your actual question, you just need to omit the top player from whatever logic your code is running from. So if you have an iterative loop over top players, skip the first index by doing nothing for it. I don’t know your current implementation (or if you have one at all), so it’s hard to determine an exact way in your scenario to omit the first ranking player.