Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Can anyone make this local? details below

I'm trying to make a mute music button and am still quite new to scripting. I've got as far as making the remote event and two scripts needed, but when clicked it mutes the music for everyone rather than the person clicking, can anyone find a way around this?

Gui Button: (LocalScript)

script.Parent.MouseButton1Click:Connect(function()
	
game:GetService("ReplicatedStorage").RemoteEvents.MuteMusic:FireServer()
	
end)

Receiving Script: (Script)

game:GetService("ReplicatedStorage").RemoteEvents.MuteMusic.OnServerEvent:Connect(function(Player)	
	
script.Parent.Volume = "0"
	
end)

1 comment

0

the code kinda cut off sorry

1 answer

✓ Accepted answer

If you are trying to locally mute the music, you don't have to use RemoteEvent because the change doesn't have to be replicated to everyone. Which means that you can directly set the volume of the sound to 0 from local script. Also, I think you can add 1 if statement to check if the sound is on, turn it off and vice versa.

local soundOn = true
script.Parent.MouseButton1Down:Connect(function())
	if soundOn == true then
		workspace.Sound.Volume = 0
		soundOn = false
	elseif soundOn == false then
		workspace.Sound.Volume = 1
		soundOn = true 
	end
end)

1 comment

0

I was mainly using remote events for security but I will be sure to give your way a go tyy

This discussion is preserved as it was. New answers, comments, and votes are closed.