local SoundRegionsWorkspace = game.Workspace:WaitForChild("MusicRegions")
local Found = false
while wait() do
for i, v in pairs (SoundRegionsWorkspace:GetChildren()) do
Found = false
local region = Region3.new(v.Position - (v.Size/2),v.Position + (v.Size/2))
local parts = game.Workspace:FindPartsInRegion3WithWhiteList(region, game.Players.LocalPlayer.Character:GetDescendants())
for _, part in pairs(parts) do
if part:FindFirstAncestor(game.Players.LocalPlayer.Name) then
Found = true
break
else
Found = false
end
end
if Found == true then
local sound = workspace.Sound
if v.Name == "inRegion" then
sound.Volume = 0.5
end
if v.Name == "outsideRegion" then
sound.Volume = 0.05
end
else
workspace.Sound.Volume = 0
end
end
end
When the player enters "outsideRegion" region then the music's volume goes 0.05 but when the player enters the "inRegion" region then the volume goes 0.5 when it should go 0.5? Any Solution?
