when i jump it does nothing.
I think the event is called StateChanged
, and not StateChange
. Put a “d” at the end and it should be fixed
put a d at the end of this?
yes. (30characarters34421gfhfgh
works! but VERY unresponsive. I did 20 jumps and it said I did 4
example of that:
robloxapp-20200322-1208291.wmv (4.1 MB)
Maybe this way will work better:
player.CharacterAdded:Connect(function(character)
local humanoid = character:WaitForChild("Humanoid")
humanoid:GetPropertyChangedSignal("Jump"):Connect(function()
if humanoid.Jump == true then
jumpCount.Value = jumpCount.Value + 1
end
end)
Replace your old character added function to this, and let me know if it works.
when held space bar it gives 2 per jump
Maybe add a cooldown? Like this:
player.CharacterAdded:Connect(function(character)
local humanoid = character:WaitForChild("Humanoid")
local debounce = true
humanoid:GetPropertyChangedSignal("Jump"):Connect(function()
if debounce == true then
debounce = false
if humanoid.Jump == true then
jumpCount.Value = jumpCount.Value + 1
end
wait(0.2)
debounce = true
end
end)
like that?
Yep, this would give it an 0.2 second cooldown. Maybe the problem was that it sometimes fires twice rapidly.
but now the leaderboard wont show.
Can you show me a video? That’s weird.
Oh, nothing is ending the character added function. Put another end)
at the end of your script.
Put another end)
at the end, the player added function also isn’t closed. Forgot about that
Input from the spacebar changes the state of humanoid to jumping, which will cause unreliability in the script. Try using Humanoid.FloorMaterial, as stated earlier.
like this?
game.Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player
local jumpCount = Instance.new("IntValue")
jumpCount.Name = "Jumps"
jumpCount.Parent = leaderstats
player.CharacterAdded:Connect(function(character)
local humanoid = character:WaitForChild("Humanoid")
local debounce = true
humanoid:GetPropertyChangedSignal("Jump"):Connect(function()
if debounce == true then
debounce = false
if humanoid.Jump == true then
jumpCount.Value = jumpCount.Value + 1
end
wait(0.2)
debounce = true
end
end)
end)
end)
Yeah, if it still isn’t reliable try something that someone else suggested.