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

How can a value be increased in a specific column (leaderboard)?

Asked by 7 years ago
Edited 7 years ago

I just want to expand on this (based on touching a part and a value going up):

function onTouch(part) 
    local humanoid = part.Parent:FindFirstChild("Humanoid") 
    if (humanoid ~= nil) then
        game.Players.LocalPlayer.leaderstat.Status.Value + 2
        wait(0.003)
        script.Parent:Destroy()
    end 
end
script.Parent.Touched:connect(onTouch)

0
value = value +2 skillfulzombie88 28 — 7y
0
??????? ProgrammableGami 23 — 7y

2 answers

Log in to vote
0
Answered by
Kuzx 22
7 years ago
1
function onTouch(part)
    local humanoid = part.Parent:FindFirstChild("Humanoid")
    if (humanoid ~= nil) then
game.Players.LocalPlayer.leaderstat.Status.Value = game.Players.LocalPlayer.leaderstat.Status.Value + 2 -- <-- Just Repeat the Line of Code and add + 2 at the end.
        wait(0.003)
        script.Parent:Destroy()
    end
end
script.Parent.Touched:connect(onTouch)
0
Thanks too! ProgrammableGami 23 — 7y
Ad
Log in to vote
0
Answered by
OfcPedroo 396 Moderation Voter
7 years ago
Edited 7 years ago

Your savior is here man xD (jk don't be mad at me please)

What you want there up, is to get the value you have, and add 2 to the value itself right?

When doing maths, you can also use values from locations. Here, I'll give you an example.

anything.Value = anything.Value + 2 --In here we're adding 2 to the value. You can do the same with multiplying (*), dividing (/), and taking (-).

In your case, the code would be this:

function onTouch(part) 
    local humanoid = part.Parent:FindFirstChild("Humanoid") 
    if (humanoid ~= nil) then
        game.Players.LocalPlayer.leaderstats.Status.Value = game.Players.LocalPlayer.leaderstats.Status.Value + 2
        wait(.003)
        script.Parent:Destroy()
    end 
end
script.Parent.Touched:connect(onTouch)


If this works, please mark as correct, and good scripting! :>

0
Thanks bro! ProgrammableGami 23 — 7y
0
Np! ;) OfcPedroo 396 — 7y

Answer this question