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

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

Asked by 5 years ago
Edited 5 years ago

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)
0
Im so sorry if its bad! vincentthecat1 199 — 5y
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. ChefDevRBLX 90 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

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)
0
@ChefDevRBLX Thanks! vincentthecat1 199 — 5y
0
It works thanks so much! vincentthecat1 199 — 5y
0
So will you accept my answer? Just so we can both get reputation and so other people know it works :) ChefDevRBLX 90 — 5y
0
Yup! vincentthecat1 199 — 5y
Ad

Answer this question