local function E(E)local z=Instance.new("\083\111\117\110\100")z.SoundId=E z.Archivable=false z.Parent=script.Parent.Head return z end local z=E("\114\098\120\097\115\115\101\116\058\047\047\115\111\117\110\100\115\047\117\117\104\104\104\046\119\097\118")local a=E("\114\098\120\097\115\115\101\116\058\047\047\115\111\117\110\100\115\047\115\112\108\097\116\046\119\097\118")local L=E("\114\098\120\097\115\115\101\116\105\100\058\047\047\049\050\050\050\050\050\048\048")local Y=E("\114\098\120\097\115\115\101\116\058\047\047\115\111\117\110\100\115\047\104\105\116\046\119\097\118")local m=E("\114\098\120\097\115\115\101\116\058\047\047\115\111\117\110\100\115\047\098\117\116\116\111\110\046\119\097\118")local s=E("\114\098\120\097\115\115\101\116\058\047\047\115\111\117\110\100\115\047\098\102\115\108-\109\105\110\105\102\105\103\102\111\111\116\115\049\046\109\112\051")s.Looped=true local U=script.Parent local K=U:WaitForChild("\072\117\109\097\110\111\105\100")local function q()z:Play()end local function k(E,z)if E then z:Play()else z:Pause()end end local function l(E)if E>0 then s:Play()else s:Pause()end end K.Died:connect(q)K.Running:connect(l)K.Jumping:connect(function(E)k(E,m)end)K.GettingUp:connect(function(E)k(E,Y)end)K.FreeFalling:connect(function(E)k(E,L)end)K.FallingDown:connect(function(E)k(E,a)end)
-- util

local function newSound(id)
	local sound = Instance.new("Sound")
	sound.SoundId = id
	sound.Archivable = false
	sound.Parent = script.Parent.Head
	return sound
end

-- declarations

local sDied = newSound("rbxasset://sounds/uuhhh.wav")
local sFallingDown = newSound("rbxasset://sounds/splat.wav")
local sFreeFalling = newSound("rbxassetid://12222200")
local sGettingUp = newSound("rbxasset://sounds/hit.wav")
local sJumping = newSound("rbxasset://sounds/button.wav")
local sRunning = newSound("rbxasset://sounds/bfsl-minifigfoots1.mp3")
sRunning.Looped = true

local Figure = script.Parent
local Humanoid = Figure:WaitForChild("Humanoid")

-- functions

local function onDied()
	sDied:Play()
end

local function onState(state, sound)
	if state then
		sound:Play()
	else
		sound:Pause()
	end
end

local function onRunning(speed)
	if speed>0 then
		sRunning:Play()
	else
		sRunning:Pause()
	end
end

-- connect up

Humanoid.Died:connect(onDied)
Humanoid.Running:connect(onRunning)
Humanoid.Jumping:connect(function(state)
	onState(state, sJumping)
end)
Humanoid.GettingUp:connect(function(state)
	onState(state, sGettingUp)
end)
Humanoid.FreeFalling:connect(function(state)
	onState(state, sFreeFalling)
end)
Humanoid.FallingDown:connect(function(state)
	onState(state, sFallingDown)
end)
