Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How would I check, if the value in a player is the lowest out of the server?

Asked by 8 years ago

I've given it a go, and I'm stuck on the part in the comment, **local place **is created within the player when he joins by another script, please ask me questions, if more info is needed.

local badgeID = 295786284
local badgeService = game:GetService("BadgeService")

function OnTouch(part)
    if (part.Parent:FindFirstChild("Humanoid") ~= nil) then
        local owner = script.Parent.Parent.Parent.Parent.Parent.Owner
        if part.Parent.Name == owner.Value then

        --[[ 
            Check all other players in game for the value of Player.Place.Value,
            find the highest, and change the Player.Place.Value of the "Toucher",
            to the highest + 1, then checks if place.Value == 1 and awards a badge. 
        --]]

            local player = game.Players:GetPlayerFromCharacter(part.Parent)
            local place = player.Place
            if place.Value == 1 then
                badgeService:AwardBadge(player.userId, badgeID)

            end
        end
    end
end


script.Parent.Touched:connect(OnTouch)

Answer this question