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

Whats the script for values to go up when something is touched?

Asked by 6 years ago

I have made a leaderboard and I want its value to go up every time a block is pressed.

2 answers

Log in to vote
0
Answered by
Anubizx 76
6 years ago

Try anything like this in the block that will be touched:

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)

You need to change leaderstat.Status for your "Value Name"

0
What if its value needs to go up in a leaderboard? ProgrammableGami 23 — 6y
0
Just remove the = and put + .... Example: game.Players.LocalPlayer.leaderstat.Status.Value + 2 Anubizx 76 — 6y
Ad
Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

Did you not read the community guidelines, it clearly says not to just ask for people to make you scripts

0
Sorry ProgrammableGami 23 — 6y

Answer this question