I want to make a leaderboard that tracks the amount of times you jump. I've tried everything to make it but i can't figure it out. help please
COMMUNITY QUESTION
Leaderboard that tracks jumps?
1 answer
Make this a server script inside of ServerScriptService
game.Players.PlayerAdded:Connect(function(plr) -- Get the player when they join
local leaderstats = Instance.new('IntValue') -- Create a new int value
leaderstats.Name = 'leaderstats'
leaderstats.Parent = plr -- Parent the IntValue to the player
local jumps = Instance.new('IntValue') -- Create another intvalue
jumps.Name = 'Jumps'
jumps.Parent = leaderstats -- Parent this IntValue to leaderstats
jumps.Value = 0
end)
Make this a localscript in somewhere like StarterGui
local player = game.Players.LocalPlayer -- Get the player
local char = player.Character or player.CharacterAdded:Wait() -- Get the character
local leaderstats = player:WaitForChild("leaderstats") -- Find leaderstats in the player
local jumps = leaderstats:WaitForChild("Jumps") -- Find jumps in leaderstats
local db = false -- A debounce to stop the function running more than once while jumping.
char.Humanoid.Changed:Connect(function() -- If any Humanoid properties are changed then this function will run
if char.Humanoid.Jump == true and db == false then -- If the player jumped then...
db = true
jumps.Value = jumps.Value + 1 -- ... add 1 onto the players jump value.
wait(0.5)
db = false
end
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
The easiest way would be making a leaderstats for your player called jump, and make a key down event (on space) that adds +1 or so to the stats
But then they can just spam the spacebar as many times as they would like without having to actually jump.