I want to play an animation only when the player jumps and is touching a part. How would I do that.
P.S. I have not been able to find anything on the wiki.
There is a simple, approximate solution to this and there are plentifully more complicated ones.
Just to clarify:
(1) You write that you want the animation to play when the player jumps "and is touching a part" - I interpret this to mean "and is on the ground"; the animation should only trigger if the player is supported by something (i.e. not falling).
(2) You aren't wanting to play an animation when two events are triggered; you want the animation to play when a certain, single event (Humanoid.Jumping
) fires under specific circumstances (or conditions). The event, which happens in one tiny discrete unit of time, must happen whilst the condition 'Is the player on the ground?' is 'Yes' (true
).
The ROBLOX client developers have spent a lot of time tweaking the behaviour of Player
characters and the Humanoid
- you can benefit from this. The Humanoid.Jumping
event will only fire when the player can make a valid jump, which happens to be when the character is on the ground (which is the condition you want).
So, simply put, play your animation when the Humanoid.Jumping
event fires.