#How to get players scores from LeaderStats and see who has the lowest point to kill them off?

8 messages · Page 1 of 1 (latest)

clever bronze
#

what is the script

#

i dont really understand the title

hollow kernel
#

will be killed

pearl steppe
#

for loop

hollow kernel
#
local Part = script.Parent
Part.Touched:Connect(function(hit)
            
    if hit.Parent:FindFirstChild("Humanoid") then
    
        local plr = game.Players:GetPlayerFromCharacter(hit.Parent)

        if plr.leaderstats.coins.Value < plr.leaderstats.coin.value then
            
            hit.Parent.Humanoid.Health = 0
            
        end


    end
        
    
end)```
low loom
#
function getLowestStatPlayer(statName)
    local current = math.huge
    local player = nil
    for _, Player in Players:GetPlayers() do
        local stat = player.leaderstats[statName]
        if stat.Value < current then
            current = stat.Value
            player = Player
        end
    end
    return player
end