Advertisement
HowToRoblox

JumpSoundScript

Feb 26th, 2020
7,218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.52 KB | None | 0 0
  1. local plr = game.Players.LocalPlayer
  2.  
  3.  
  4. local char = plr.Character or plr.CharacterAdded:Wait()
  5.  
  6. local humanoid = char:WaitForChild("Humanoid")
  7.  
  8.  
  9. local hasJumped = false
  10.  
  11.  
  12. local jumpSound = script.JumpSound
  13.  
  14.  
  15. humanoid.StateChanged:Connect(function(oldState, newState)
  16.    
  17.    
  18.     if newState == Enum.HumanoidStateType.Jumping then
  19.        
  20.        
  21.         if hasJumped then return end
  22.        
  23.         hasJumped = true
  24.        
  25.        
  26.         jumpSound:Play()
  27.        
  28.        
  29.     elseif newState == Enum.HumanoidStateType.Landed then  
  30.        
  31.        
  32.         hasJumped = false
  33.     end
  34. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement