Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I make a block add a point to a leaderboard?

Please help! |Script!|

local ting = 0 --debouncer

function onTouched(hit)

 if ting == 0 then
 ting = 1 --activate debounce
 check = hit.Parent:FindFirstChild("Humanoid")
 
 if check ~= nil then



   local user = game.Players:GetPlayerFromCharacter(hit.Parent)
   local stats = user:findFirstChild("LeaderStats")

   if stats ~= nil then 
       local cash = stats:findFirstChild("Deaths")
       Deaths.Value = Deaths.Value +1
       wait(1)
    end
end
ting = 0
end

end

script.Parent.Touched:connect(onTouched)

2 comments

0

Im so sorry if its bad!

0

Ill hrlp but next time dont use something out of the toolbox.. i found 10 different objects using the same script as you just used. But as said ill help.

1 answer

✓ Accepted answer

Put this in the part. And your script did not work because "Check" was not localized... So I hope this helps :)

ting = false

script.Parent.Touched:connect(function(hit)

if hit.Parent:FindFirstChild("Humanoid") then

local player = game.Players:GetPlayerFromCharacter(hit.Parent)

if ting == false then

ting = true

player.leaderstats.Pounds.Value = player.leaderstats.Pounds.Value + 1 -- Change "Deaths" to the name of your leaderstats. Change "1" to the amount of stats it gives you.

wait(0.5)

ting = false

end

end

end)

4 comments

0

@ChefDevRBLX Thanks!

0

It works thanks so much!

0

So will you accept my answer? Just so we can both get reputation and so other people know it works :)

0

Yup!

This discussion is preserved as it was. New answers, comments, and votes are closed.