null nil false Script while script.Parent.Head==nil do wait(0.05) end function newSound(id) local sound = Instance.new("Sound") sound.SoundId = id sound.Parent = script.Parent.Head return sound end sDied = newSound("rbxasset://sounds/uuhhh.wav") sFallingDown = newSound("rbxasset://sounds/splat.wav") sFreeFalling = newSound("rbxasset://sounds/swoosh.wav") sGettingUp = newSound("rbxasset://sounds/hit.wav") sJumping = newSound("rbxasset://sounds/button.wav") sRunning = newSound("rbxasset://sounds/bfsl-minifigfoots1.mp3") sRunning.Looped = true function onDied() sDied:play() end function onState(state, sound) if state then sound:play() else sound:pause() end end function onRunning(speed) if speed>0 then sRunning:play() else sRunning:pause() end end while script.Parent.Humanoid==nil do wait(0.05) end h = script.Parent.Humanoid h.Died:connect(onDied) h.Running:connect(onRunning) h.Jumping:connect(function(state) onState(state, sJumping) end) h.GettingUp:connect(function(state) onState(state, sGettingUp) end) h.FreeFalling:connect(function(state) onState(state, sFreeFalling) end) h.FallingDown:connect(function(state) onState(state, sFallingDown) end) -- regeneration while true do local s = wait(1) local health=h.Health if health>0 and health<h.MaxHealth then health = health + 0.01*s*h.MaxHealth if health*1.05 < h.MaxHealth then h.Health = health else h.Health = h.MaxHealth end end end