Im trying to make a muffle effect for sounds when on low on hp, it kinda works but it always goes down to -80 no matter how much damage you take!
local Player = game.Players.LocalPlayer
repeat wait() until Player.Character ~= nil
local Humanoid = Player.Character:WaitForChild("Humanoid")
local MaxHealth = Humanoid.MaxHealth
local newHealth = Humanoid.Health
Humanoid:GetPropertyChangedSignal("Health"):Connect(function()
if newHealth > Humanoid.Health then
for i, v in pairs(game.Workspace.Music:GetChildren()) do
game:GetService("TweenService"):Create(v.EqualizerSoundEffect, TweenInfo.new(1.5), {HighGain = -(Humanoid.Health/Humanoid.MaxHealth * 500), MidGain = -(Humanoid.Health/Humanoid.MaxHealth * 500) }):Play()
end
elseif newHealth < Humanoid.Health then
for i, v in pairs(game.Workspace.Music:GetChildren()) do
game:GetService("TweenService"):Create(v.EqualizerSoundEffect, TweenInfo.new(1.5), {HighGain = (Humanoid.Health/Humanoid.MaxHealth / 500), MidGain = (Humanoid.Health/Humanoid.MaxHealth / 500) }):Play()
end
end
newHealth = Humanoid.Health
end)
this is my script that im using.
