I am just doing parkour game and i can't understand how to do it.
How can i make jump counter to leaderboards in my game?
2 answers
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
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
Oh ok, i will try.
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
Are you getting an error?
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.

1 comment
Do you have any script or anything