So basically I have a script for region music for my game and since I have a radio gamepass in my game I want to have a feature where people can mute the background music to hear the radio better. The script does show that it makes the volume of the music in the game to 0 but doesn't actually show a difference ingame. The scripts are

Music = game.StarterGui.SoundRegions.place0
hidden = 1
function RunGui()
if hidden == 1 then 
	hidden = 2
	script.Parent.Text = "Unmute Music"
	Music.Volume = 0
else
	hidden = 1
	script.Parent.Text = "Mute Music"
	Music.Volume = 0.3
end
end
script.Parent.MouseButton1Down:connect(RunGui)

^ mute/unmute button

local SoundRegionsWorkspace = game.Workspace:WaitForChild("SoundRegions")
local Found = false

while wait(1) 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
			if script.Parent.SoundRegions[v.Name].IsPlaying == false then
				script.parent.SoundRegions[v.Name]:Play()
				break
			end
		else
			script.Parent.SoundRegions[v.Name]:Stop()
		end
		
	end
end

^ region music scripts. Anything helps.

2 comments

0

Wait a minute sound regions like this https://www.youtube.com/watch?v=L_Jga2MgRdU

0

Yeah exactly like that actually, since im new to scripting I just ask some people I know for help and use tutorials on scripting