I'm not sure if Jump is boolean value because this doesn't seem to work.
local humanoid = game.Players.LocalPlayer.Character:WaitForChild("Humanoid")
if humanoid.Jump.Value == true then
print("the player has jumped")
end
I'm not sure if Jump is boolean value because this doesn't seem to work.
local humanoid = game.Players.LocalPlayer.Character:WaitForChild("Humanoid")
if humanoid.Jump.Value == true then
print("the player has jumped")
end
You are very close, try this:
Player = game.Players.LocalPlayer
Character = Player.Character or Player.CharacterAdded:Wait()
Humanoid = Character:WaitForChild('Humanoid')
local isJumping = false
Humanoid.StateChanged:Connect(function(oldState, newState)
if newState == Enum.HumanoidStateType.Jumping then
if not isJumping then
isJumping = true
end
elseif newState == Enum.HumanoidStateType.Landed then
if isJumping then
isJumping = false
end
end
end)
This uses StateChanged to detect when a player has started to jump, and when the player has landed.
This discussion is preserved as it was. New answers, comments, and votes are closed.
1 comment
You can learn more about it here: https://developer.roblox.com/en-us/api-reference/event/Humanoid/StateChanged