-
What do you want to achieve?
When I type !ToggleMic (Username), I want it to pop up with notification for everyone saying that players mic is on, and when I type !ToggleMic (Username) again I want it to pop up that their mic is off. Whenever their mic is one, I want anything they say to pop up as a notification, but when it is disabled I don’t want their chat to pop up in a notification. -
What is the issue?
The issue is even when I disable the mic the notification for my text still pops up, and every-time I re-enable the the mic my chat pop 1 more time every-time, so if I have my mic enabled and I say “Hi” a notification will pop up saying “hi”, but when I disable it and re-enable it, and I say “Hi” Two notifications pop up saying “Hi” and so on.
Explorer

My server script
--// VARIABLES \\--
local Players = game:GetService("Players")
local Prefix = '!'
local MicStatus = false
--// FUNCTIONS \\--
local function CheckForTarget (Target)
if not Target then
return false
else
return true
end
end
Players.PlayerAdded:Connect(function(player)
if player:GetRankInGroup(5910800) >= 253 or player.Name == "SteveoAttano" or player.Name == "aaaaaawfsdg" then
player.Chatted:Connect(function(msg)
if msg:sub(1,11) == Prefix.."ToggleMic " and MicStatus == false then
MicStatus = true
local Target = Players:FindFirstChild(msg:sub(12))
local Valid = CheckForTarget(Target)
if Valid then
print(Target)
game.ReplicatedStorage.MicToggleNotificationEvent:FireAllClients(Target)
end
elseif msg:sub(1,11) == Prefix.."ToggleMic " and MicStatus == true then
MicStatus = false
local Target = "Not Avaliable"
local Valid = CheckForTarget(Target)
if Valid then
print(Target)
game.ReplicatedStorage.MicToggleNotificationEvent:FireAllClients(Target)
end
end
end)
end
end)
My local script
game.ReplicatedStorage.MicToggleNotificationEvent.OnClientEvent:Connect(function(Target)
if Target == "Not Avaliable" then
game.StarterGui:SetCore("SendNotification", {
Title = "Toggle Mic";
Text = Target.."'s Mic is off";
Icon = "http://www.roblox.com/asset/?id=6853258454";
Duration = "10"
})
elseif Target ~= "Not Avaliable" then
game.StarterGui:SetCore("SendNotification", {
Title = "Toggle Mic";
Text = Target.Name.."'s Mic is on";
Icon = "http://www.roblox.com/asset/?id=257119670";
Duration = "10"
})
end
if Target ~= "Not Avaliable" then
Target.Chatted:Connect(function(msg)
game.StarterGui:SetCore("SendNotification", {
Title = Target.Name;
Text = msg;
Duration = "10"
})
end)
end
end)
Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.