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 )
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
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.
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.
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?