I want a script that when you jump you lose stamina. I try to search with the space key but that dont work....
✓ ANSWER ACCEPTED
how to make a script that change a value when you jump ?
1 answer
✓ Accepted answer
You can use either Jumping or StateChanged. They are both events of a Humanoid that can be used to tell when a Humanoid is jumping. Because they are events, you would connect them to functions, like so:
Using Jumping:
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
character.Humanoid.Jumping:Connect(function()
-- Code here
end)
end)
end)
Using StateChanged, which fires with two arguments, the original state and the new state of the Humanoid:
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
character.Humanoid.StateChanged:Connect(function(originalState, newState)
-- Code here
end)
end)
end)
By using the code given, you can expand upon what I gave you as examples to accomplish what you're looking to do.
3 comments
0
Also, one other thing: You don't necessarily need user input. Jumping takes care of that for you.
0
THHHXXX!!!!!
0
accept the answer
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
https://developer.roblox.com/api-reference/event/Humanoid/StateChanged