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 it so that when i step on a certain block, it gives me +1 leaderstat point?

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.

1 comment

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.

2 answers

✓ Accepted answer

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!

1 comment

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)

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)

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