So this script is supposed to make the volume decrease what audio is playing in a folder then make the other one corresponding to the team go up in volume, the volume up part works but the volume down doesn’t work. It doesn’t find any volume at 0.4 because it doesn’t print “Found” nor the sound name.
File Structure:
local TweenService = game:GetService("TweenService")
local off = {Volume = 0}
local on = {Volume = 0.4}
game.Players.LocalPlayer:GetPropertyChangedSignal("Team"):Connect(function()
if game.Players.LocalPlayer.Team == game.Teams.Alive then
for _, sound in ipairs(script.Parent.Music:GetChildren()) do
if sound.Volume == 0.4 and sound.Name ~= "FightArea" then
print("Found")
print(sound.Name)
local volD = TweenService:Create(sound,TweenInfo.new(2),off)
volD:Play()
end
end
wait(2)
local volUp = TweenService:Create(script.Parent.Music.FightArea, TweenInfo.new(2), on)
volUp:Play()
elseif game.Players.LocalPlayer.Team == game.Teams.Lobby or game.Players.LocalPlayer.Team == game.Teams.AFK then
for _, sound in ipairs(script.Parent.Music:GetChildren()) do
if sound.Volume == 0.4 and sound.Name ~= "Lobby" then
print("Found")
print(sound.Name)
local volD = TweenService:Create(sound,TweenInfo.new(2),off)
volD:Play()
end
end
wait(2)
local volUp = TweenService:Create(script.Parent.Music.Lobby, TweenInfo.new(2), on)
volUp:Play()
elseif game.Players.LocalPlayer.Team == game.Teams["NPC Arena"] then
for _, sound in ipairs(script.Parent.Music:GetChildren()) do
if sound.Volume == 0.4 and sound.Name ~= "SoloArena" then
print("Found")
print(sound.Name)
local volD = TweenService:Create(sound,TweenInfo.new(2),off)
volD:Play()
end
end
wait(2)
local volUp = TweenService:Create(script.Parent.Music.SoloArena, TweenInfo.new(2), on)
volUp:Play()
end
end)
Any help would be appreciated, thanks.