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

How to make a obby leaderboard?

Asked by 9 years ago

I need help on creating an Obby Leaderboard, I simply cannot figure out how to do it myself! All i want in this Obby Leaderboard is a Stage Place and a Deaths Place (No kills)

Once again How do you do this???

0
Use scripts. (This isn't a request site) minikitkat 687 — 9y
0
Yeah but i cant find a script! And im not good at scripting. (Well partly i just started) AyeeAndrxw 35 — 9y
0
Go see LuaLearners.org if you need a good place to learn scripting EchoReaper 290 — 9y
0
Read the rules of asking questions. NeonicPlasma 181 — 9y

1 answer

Log in to vote
0
Answered by 9 years ago

So let's start off with making a script that gives them the value.

game.Players.PlayerAdded:connect(function(player)
     local leaderstats = Instance.new("Model")
     leaderstats.Name = "leaderstats"
     leaderstats.Parent = player

     local money = Instance.new("IntValue") --We create a new IntValue
     money.Name = "Stage" --this is the name you want the leader-stat to be when it shows up in-game.
     money.Value = 1 --this is the value of money the new player starts out with. To change this, you can add some more code (shown later)
     money.Parent = leaderstats -- Set the money object as a child of the leaderstats object.
 end)

Now in studio, open the toolbox. Get a spawn. Insert a script in it saying:

function onTouched(part)
    name = script.Parent.Name
        local h = part.Parent:FindFirstChild("Humanoid")
    if h ~= nil then
        char = h.Parent
        player = char:GetPlayerFromCharacter(char)
            if player ~= nil then
                leaderstats = player.FindFirstChild("leaderstats")
                if leaderstats ~= nil then
                    stage = leaderstats:FindFirstChild("Stage")
                    if stage ~= nil then
                        stage.Value = name
                    end
                end
            end
        end
    end
end

script.Parent.Touched:connect(onTouched) -- Links event to function

Make sure that you name the part a number. The first spawn needs to be named 1, the second needs to be named 2, the third needs to be called 3, and so on.

(This only does the stage and this was not tested.) Tell me if it doesn't work. --PUB1

Ad

Answer this question