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.

01game.Players.PlayerAdded:connect(function(player)
02     local leaderstats = Instance.new("Model")
03     leaderstats.Name = "leaderstats"
04     leaderstats.Parent = player
05 
06     local money = Instance.new("IntValue") --We create a new IntValue
07     money.Name = "Stage" --this is the name you want the leader-stat to be when it shows up in-game.
08     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)
09     money.Parent = leaderstats -- Set the money object as a child of the leaderstats object.
10 end)

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

01function onTouched(part)
02    name = script.Parent.Name
03        local h = part.Parent:FindFirstChild("Humanoid")
04    if h ~= nil then
05        char = h.Parent
06        player = char:GetPlayerFromCharacter(char)
07            if player ~= nil then
08                leaderstats = player.FindFirstChild("leaderstats")
09                if leaderstats ~= nil then
10                    stage = leaderstats:FindFirstChild("Stage")
11                    if stage ~= nil then
12                        stage.Value = name
13                    end
14                end
15            end
16        end
17    end
18end
19 
20script.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