I don't Understand why it mutes the radio on the server instead of just the client when I mute a radio in my game

Both Local Scripts Are Located Inside The Settings Frame, Which the Settings Frame Is located in A ScreenGui Located in StarterGui

Picture Of Explorer For Gui: Pic

First Script ( Adds Players To Mute Folder And Mutes Them)

local SF = script.Parent
local Muting = SF.Muting
local Holder = Muting.Holder
local PlayerF = Holder.Player:Clone()
Holder.Player:Destroy()

local Muted = SF.Muted
local Volumes = {
	["Advanced Boombox"] = 1.8,
	["Intermediate Boombox"] = 1.3,
	["Basic Boombox"] = 0.7,
	["BoomBox"] = 0.4,
	["Owner Boombox"] = 5
}

function Update()
	
	for _, Child in pairs(Holder:GetChildren()) do
		
		if Child:IsA("TextButton") then
			
			if not game.Players:FindFirstChild(Child.Name) then
				
				Child:Destroy()
				
			end
			
		end
		
	end
	
	for _, Player in pairs(game.Players:GetPlayers()) do
		local Char = Player.Character
		
		if not Holder:FindFirstChild(Player.Name) then
		
			local pClone = PlayerF:Clone()
			pClone.Name = Player.Name
			pClone.Text = Player.Name
			pClone.Parent = Holder
			
			pClone.MouseButton1Click:Connect(function()
				
				if Muted:FindFirstChild(Player.Name) then
					
					Muted[Player.Name]:Destroy()
					
					local Tool = Char:FindFirstChildWhichIsA("Tool")
					
					if Tool then
						local Handle = Tool.Handle
						local Sound = Handle:FindFirstChildWhichIsA("Sound")
						if Sound then
							Sound.Volume = Volumes[Tool.Name]
						end
					end
					return
				elseif not Muted:FindFirstChild(Player.Name) then
					
					local M = Instance.new("BoolValue")
					M.Name = Player.Name
					M.Parent = Muted
					
					local Tool = Char:FindFirstChildWhichIsA("Tool")
					
					if Tool then
						local Handle = Tool.Handle
						local Sound = Handle:FindFirstChildWhichIsA("Sound")
						if Sound then
							Sound.Volume = 0
						end
					end
					
				end
				
			end)
		
		end
		
	end
	
end

while true do
	
	Update()
	
	wait()
	
end

Second Script (Keeps Players Muted When They Play New Audios or Take Out Tool Again)

local sf = script.Parent
local muted = sf.Muted

local Volumes = {
	["Advanced Boombox"] = 1.8,
	["Intermediate Boombox"] = 1.3,
	["Basic Boombox"] = 0.7,
	["BoomBox"] = 0.4,
	["Owner Boombox"] = 5
}

while wait() do
	for i,v in pairs(muted:GetChildren()) do
		local Player = game.Players:FindFirstChild(v.Name)
		if Player then
			local Char = Player.Character
			local Tool = Char:FindFirstChildWhichIsA("Tool")
			if Tool then
				local Handle = Tool.Handle
				local Sound = Handle:FindFirstChildWhichIsA("Sound")
				if Sound then
					Sound.Volume = 0
				end
			end
		end
	end
	for i,v in pairs(game.Players:GetPlayers()) do
		if not muted:FindFirstChild(v.Name) then
			local Char = v.Character
			local Tool = Char:FindFirstChildWhichIsA("Tool")
			if Tool then
				local Handle = Tool.Handle
				local Sound = Handle:FindFirstChildWhichIsA("Sound")
				if Sound then
					Sound.Volume = Volumes[Tool.Name]
				end
			end
		end
	end
end

2 comments

0

A little more information on the Location of everything (e.g. where are these scripts located, what the variables are, etc..)

0

Editted