Advertisement
devvanss

[LUA] FootSteps Script

Apr 18th, 2019
1,878
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.10 KB | None | 0 0
  1. --// Put this in the SoundService: https://www.roblox.com/library/3088104758/Footstep-Sounds
  2.  
  3. --// Client
  4.  
  5. local Character = script.Parent
  6. local Head = Character:WaitForChild("Head")
  7. local RunningSound = Head:WaitForChild("Running")
  8. local FootstepsSoundGroup = game:GetService("SoundService"):WaitForChild("Footsteps")
  9. local Humanoid = Character:WaitForChild("Humanoid")
  10.  
  11. --// Sounds
  12.  
  13. Humanoid.Changed:Connect(function(property)
  14.    
  15.     if property == "FloorMaterial" then    
  16.         RunningSound.SoundId = FootstepsSoundGroup:WaitForChild(Humanoid.FloorMaterial).SoundId
  17.         RunningSound.PlaybackSpeed = FootstepsSoundGroup:WaitForChild(Humanoid.FloorMaterial).PlaybackSpeed
  18.         RunningSound.Volume = FootstepsSoundGroup:WaitForChild(Humanoid.FloorMaterial).Volume
  19.        
  20.         if FootstepsSoundGroup:FindFirstChild(Humanoid.FloorMaterial) == nil then
  21.             RunningSound.SoundId = FootstepsSoundGroup:WaitForChild("nil Sound").SoundId
  22.             RunningSound.PlaybackSpeed = FootstepsSoundGroup:WaitForChild("nil Sound").PlaybackSpeed
  23.             RunningSound.Volume = FootstepsSoundGroup:WaitForChild("nil Sound").Volume
  24.            
  25.         end
  26.     end
  27. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement