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

How do i make it so that when i step on a certain block, it gives me +1 leaderstat point?

Asked by
jixere 2
3 years ago

I also want it to have it so that yu can only step on it ONCE. For example, i will use this in an obby. When they step on a block, they get +1 leader point. But when they go back to their previous checkpoint, it wouldnt give them a point. So its technically a stage counter but in a less complex way.

0
You can change the value by +1 and and if the checkpoint number they step on is less than the value of their leaderstats, you don't need to run any function. kingblaze_1000 359 — 3y

2 answers

Log in to vote
1
Answered by 3 years ago

Try This:

script.Parent.Touched:Connect(function(hit)
    local Hum = hit.Parent:FindFirstChild("Humanoid")
    if Hum then
        local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
        local sname = "Credits" -- The name of the stat
        local sval = 25 -- How much to give
        plr.leaderstats:FindFirstChild(sname).Value = sval
    end
end)

If you want something more intense I can create it :). Hope this helps!

0
thats good but i want it like so its locked once you step on it once. For example, when you step on it, you can step on it again. (like you already claimed it) jixere 2 — 3y
Ad
Log in to vote
1
Answered by 3 years ago

Maybe place a script inside the object and do

object = script.Parent debounce = true

object.Touched:connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") and debounce then debounce = false humanoid = hit.Parent:FindFirstChild("Humanoid") if humanoid then local plr = game.Players:GetPlayerFromCharacter(humanoid.Parent) plr.Leaderstats.Points = plr.Leaderstats.Points + 1 -- Change where its located end end end)

Answer this question