Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How Would I disable the chat in a server script not local ?

Asked by 5 years ago

So the reason why I want to do this is because the chat has no use also the reason I don't want to use local scripts is because exploiters can easily change the script so im trying to do everything on server

1
You should refrain from doing absolutely everything with server scripts for reasons like there will be a huge amount of server lag, and some stuff like this aren't actually possible with server scripts. BenjySmb 16 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago
Edited by User#24403 5 years ago

Modifying the client in such a way from a server script isn't possible without RemoteEvents or RemoteFunctions. The chat GUI isn't visible to the server by itself.

If you wanted the server to have any doing with disabling the chat, you could use Players.PlayerAdded to get the player you want to mute...

-- Server script
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")

local Event = ReplicatedStorage:WaitForChild("RemoteEvent")

Players.PlayerAdded:Connect(function(player)
    Event:FireClient(player)
end)

...and then disable chat when the event gets called.

-- LocalScript
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local StarterGui = game:GetService("StarterGui")

local Event = ReplicatedStorage:WaitForChild("RemoteEvent")

Event.OnClientEvent:Connect(function()
    StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Chat,false)
end)

But since you just want to stop a person from chatting, you might as well just call this immediately in a LocalScript in order to be more efficient.

-- LocalScript
local StarterGui = game:GetService("StarterGui")

StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Chat,false)
0
FE is always on. "If you enable this" makes zero sense. DeceptiveCaster 3761 — 5y
0
Idiot stop being bossy ^ Maginatoc -5 — 5y
0
no u DeceptiveCaster 3761 — 5y
Ad

Answer this question