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

How can i make jump counter to leaderboards in my game?

I am just doing parkour game and i can't understand how to do it.

1 comment

0

Do you have any script or anything

2 answers

✓ Accepted answer

Here is the code:

game.Players.PlayerAdded:Connect(function(player)
	local leaderstats = Instance.new("Folder", player)
	leaderstats.Name = "leaderstats"
	
	local jumps = Instance.new("IntValue", leaderstats)
	jumps.Name = "Jumps"
	jumps.Value = 0
	
	player.CharacterAdded:Connect(function(character)
		local humanoid = character:WaitForChild("Humanoid")
		humanoid.StateChanged:Connect(function(_, newState)
			if newState.Name == "Freefall" then
				jumps.Value += 1
			end
		end)
	end)
end)

1 comment

0

Thank you so much! I really appreciate that.

Create a value inside starterpack and just create a script that detects when the player jumps and adds 1 to the value remember to post question for help this is to help with errors not entire systems

4 comments

0

Oh ok, i will try.

0

I don't think i can do that, but i tried something as well, i added NumberValue to StarterPack named: Jumps. And then i made Script in ServerScriptService but it's not working: game.Players.PlayerAdded:Connect(function(player) player.CharacterAdded:Connect(function(char) if char:WaitForChild("Humanoid").JumpPower == true then player.leaderstats.Points.Value = player.leaderstats.Points.Value

0

Are you getting an error?

0

Nope, but it's just not working, i checked output and it says nothing.

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