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

Stage and Death Leaderboard script?

Asked by 6 years ago

Im looking for a leaderboard script that just uses stages and deaths.Ive tried many things and the leaderboard has shown up but when I touched the spawn it didn't change the stage.

Can anyone help me?

0
Can you include the script User#5423 17 — 6y
0
@kingdom5 i don't think he has one. Void_Frost 571 — 6y
0
@dadcrazy101, Are you making an obby? Just saying thesit123 509 — 6y

1 answer

Log in to vote
0
Answered by
thesit123 509 Moderation Voter
6 years ago
Edited 6 years ago

This is what might what you were looking for..

game.Players.PlayerAdded:connect(function(Plr) -- Player Joined
    Plr.CharacterAdded:connect(function(Char) -- Players' Character Added
        -- Setting Variables
        local ldrstats = Instance.new("StringValue",Plr)-- Creating Leaderstats
        ldrstats.Name = "Leaderstats"
        local stge = Instance.new("IntValue", ldrstats)-- Creating Stage Value
        stge.Name = "Stage"
        stge.Value = 1
        local dths = Instance.new("IntValue", ldrstats) -- Creating Death Value
        dths.Name = "Deaths"
        dths.Value = 0

        -- Player died
        Char:WaitForChild("Humanoid").Died:connect(function() -- Finding if Player Died
            dths.Value = dths.Value + 1 -- Add one Death
        end)
    end)
end)

Have a Stage Part with a script and a value that the VALUE has the stage number.

In The Script:

script.Parent.Touched:connect(function(Hit) -- Part is Touched
    local PlrN = Hit.Parent.Name -- Get Player Name Who Touched
    local Plr = game.Players:FindFirstChild(PlrN) -- Find Player in Players with the Name
    if Plr then -- If script have found the Player
        local Ldrs = Plr:FindFirstChild("Leaderstats") -- Find Leaderstats in Player
        if Ldrs then -- If Leaderstats is found
            local Stage = Ldrs:FindFirstChild("Stage") -- Find Stage in Leaderstats
            if Stage then -- If Stage is found
                local StageV = script.Parent.Stage -- Variable for the Value to make sure players are not skipping stages
                if Stage.Value == StageV.Value then -- If their *SUPPOSED* stage is correct with the Stage Value
                    Stage.Value = Stage.Value + 1 -- Add One to the players' Stage value
                end
            end
        end
    end
end)
0
Yes I am making an obby @thesit123.I tried using the script but no leaderboard shows up.Do I need to insert it into Serverscript storage or something like that.Do I have to put it in an existing leaderboard dadcrazy101 -17 — 6y
0
@dadcrazy101, Change the Instance type from Folder to "Configuration" for Leaderstats. sorry to keep you waiting. thesit123 509 — 6y
Ad

Answer this question