i am tryna make mute command and i keep getting this error
script.Parent.MouseButton1Click:Connect(function()
local plr = game.Players:FindFirstChild(script.Parent.Parent.PlayerName.Text)
local MuteModule = require(game.Workspace.Infinite.Main.Commands.Moderating.Mute)
MuteModule.Execute("coolman21627", plr)
end)
button script
local module = {
CommandName = "Mute",
Description = "stops a player from talking.",
CanUseOn = "Player"
}
function module.Execute(AdminName, Player)
local ChatService = require(
game:GetService("ServerScriptService")
:WaitForChild("ChatServiceRunner")
:WaitForChild("ChatService")
)
local Channel = ChatService:GetChannel("All")
for _, speakerName in ipairs(Channel:GetSpeakerList()) do
Channel:MuteSpeaker(Player)
end
end
return module
game.Players.PlayerAdded:Connect(function(plr)
if plr.Name == "coolman21627" then
local MuteModule = require(game.Workspace.Infinite.Main.Commands.Moderating.Mute)
MuteModule.Execute("coolman21627", plr)
end
end)
That’s not true, it doesn’t really make a difference.
As far as the rest of this thread goes, it’s because Player is nil. Possibly @coolman21627 didn’t type the full player name with the correct capitalization.