#does anyone know how to make this do the opposite of what its doing rn

1 messages · Page 1 of 1 (latest)

calm cliff
#

so its playing music when my health drops below 0.99%, i need it to always be playing then STOP when its below 0.99%

#

local Players = game:GetService("Players")
local Player = Players.LocalPlayer

local Sound = script:WaitForChild("Sound")
local Percent_Of_Health = .99

local function Fade_Music_In()
for i = Sound.Volume, 1, .1 do
Sound.Volume = i
wait(.3)
end
end

local function Fade_Music_Out()
for i = Sound.Volume, 0, -.1 do
Sound.Volume = i
wait(.3)
end
end

Player.CharacterAdded:connect(function(character)
if character ~= nil then
local Humanoid = character:WaitForChild("Humanoid")
Humanoid.HealthChanged:connect(function(health)
if health < (Humanoid.MaxHealth * Percent_Of_Health) and health ~= 0 then
if not Sound.IsPlaying then
Sound:Play()
Humanoid.WalkSpeed = 10
Fade_Music_In()
end
else
if health > (Humanoid.MaxHealth * Percent_Of_Health) then
if Sound.IsPlaying then
Humanoid.WalkSpeed = 16
Fade_Music_Out()
Sound:Pause()
end
else
if health == 0 then
if Sound.IsPlaying then
Fade_Music_Out()
Sound:Stop()
end
end
end
end
end)
end
end)

topaz obsidian
#

you have your '>' and '<' staments around the worng way

#

(i think)

calm cliff
#

close

#

youtube tutorial

topaz obsidian
#

ah

calm cliff
#

im not smart enough to brainstorm it on my own and

#

i feel bad harassing my friend for help with all of this

topaz obsidian
#

(btw not related you can put the fade music in and out into one function and grab a vlaue, ethier a numb or true/false to set weither it fades in or out)

#

is it working now?

calm cliff
#

uhhhhhhhhhhhhhhhh

#

its doing the exact same thing as before

#

oh wait

#

wrong script

#

yeah it works now!!