Hi, how would I mute someone from a server script?
Various ways to do this, I’m going to explain the easiest:
-
Put a remote event
-
In the server script fire the remote event with the parameters you want
-
In the local script of the player listen to the remote event and when it’s called, disable his chat (startergui set core)
Can’t DarkDex get around this and destroy the local script?
Use chat’s service function mutespeaker() then
How would I access ChatService?
Example:
local channel = ChatService:GetChannel("ALL")
-- somewhere else in your code
channel:MuteSpeaker(--[[some name]])
-- to unmute
channel:UnmuteSpeaker(--[[some name]])```
ChatService isn’t defined though…
and you would get chatservice by game:getservice
Sorry I’m on mobile, let me see
Tell me if this works (your script is in serverscriptservice i assume)
local ChatService = script.Parent:WaitForChild("ChatServiceRunner").ChatService
Alr brb ima make the script im now on pc
Oops i forgot the require thing, btw you should wait for the player to load as well and use a pcall to prevent errors if the player you want to mute doesn’t exist
local ChatService = require(game:GetService("ServerScriptService"):WaitForChild("ChatServiceRunner"):WaitForChild ("ChatService"))
local channel = ChatService:GetChannel("ALL")
channel:MuteSpeaker()
channel:UnmuteSpeaker()
You’re a live saver, thanks so much man. I totally forgot that you had to require it since it’s a module script.
Thank you! I was the one who forgot actually!
Would I use the player name for this or the player instance?