Mute Button For Select People

Hi what im trying to do is make a mute button which shows up for me and others i add to a list only

My issue is that when i tried a script i found it either didnt work or showed for everyone (i checked the code and it looked fine ill show u)

    print("A player has entered: " .. player.Name)
    local list = {"123marble","yoyoy","Player"} -- Change these names to the people you want to be able to see the gui
    for i, v in pairs(list) do
        if v == player.Name then
            player.PlayerGui:WaitForChild("ScreenGui")
            player.PlayerGui.ScreenGui.Enabled = true
        end
    end
end)

idk why it doesnt work ill also show the mute button script


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.4

end

end

script.Parent.MouseButton1Down:connect(RunGui)

please tell me whats wrong i would really apreciate it (because my ears wouldnt blead :yum:)

1 Like

Do you get any errors in your output?

1 Like

May you show us the hierarchy of your script(s)?

i dont think so my plugin covered most of it anyway

the what i dont know what you mean

Show us an image of where your scripts are located please, like the explorer view.

image
image
i did rescript one of the scripts so it would find the sound in the right place (the script to play the music i dont think is visible here its also the sound one its just an example)
and the gui is disabled

Try adding yourself to this list.image

You’re using scripts in StarterGui, when you should be using LocalScripts.
The reason for that is because Scripts don’t work in StarterGui.
Also, the first script you showed us should be in ServerScriptService, other thing is that Scripts cannot access people’s GUIs, so you should be using RemoteEvents.
Another thing, exploiters could easily access the mute GUI without them being in the list, so I think an easy fix for that would be to disable it all the time unless if you’re in the list, inside a LocalScript.
Hope I helped!

Adding to what @brokenVectors said, scripts does not run in StarterGui/PlayerGui. So, you use local scripts instead.

Why don’t you combine the list of people and the mute button script together? I think it would make life much easier. Here’s how you would do it.

1. Insert a local script to StarterGui, name it whatever you want.

2. Write the player lists part, who you want to give the access of mute button to.

local player = game.Players.LocalPlayer   -- This is to identify the player that this local script belongs to.
local playerList = {"nuggetman", "notnuggetman"}

for i, v in pairs (PlayerList) do
    if v = player.Name then
        player.PlayerGui:WaitForChild("ScreenGui")
        player.PlayerGui.ScreenGui.Enabled = true
    end
end

3. Do the mute script part.

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.4
     end
end

4. Combine them together.

EDIT: Don’t forget to write that Music is. I don’t know the position of Music, so don’t forget to declare a variable referring to the position of Music.

i did its just an example of the original

you have and since @slothfulGuy added to it i can fix it

thanks but you put if v = player.Name instead of if v == player.Name
and PlayerList instead of playerList :wink:

turns out it doesnt work anything im doing wrong (i hardly changed the code i told u how i changed it and i did specify the music location)
image image

Instead of a script, use a LOCAL SCRIPT.

still dont work whats wrong with it

Can you show us if you’re experiencing errors? You are providing extremely brief and short posts, without any context to what is going on in your situation.

the gui doesnt show and yes it is disabled so it only enables when the script runs i did add my name

Again, you are not providing us with what we need. Are you having errors, can you provide GIFs and images and exact details of what is happening? What have you tried so far to fix this issue?

i havent tried anything and what i said is all i know