I am trying to make a global chat system but it doesn’t work!
Local Script
local rs = game:GetService("ReplicatedStorage")
local Chat = rs.Chat
Chat.OnClientEvent:Connect(function(msg)
game.StarterGui:SetCore("ChatMakeSystemMessage", {
Text = msg;
Font = Enum.Font.SourceSansBold;
Color = Color3.new(255,255,255);
FontSize = Enum.FontSize.Size14
})
end)
Server Script
local mss = game:GetService("MessagingService")
mss:SubscribeAsync("Global_Chat", function(msg)
local split = string.split(msg.Data, "ThIsASodONottypethsiOutYOUNOObsTrInGsEpeRaTor")
if not game.Players:FindFirstChild(split[1]) then
game.ReplicatedStorage.Chat:FireAllClients(split[2])
end
end)
game.Players.PlayerAdded:Connect(function(plr)
plr.Chatted:Connect(function(msg)
local FilteredChat = game:GetService("Chat"):FilterStringForBroadcast(msg, plr)
local FinalMsg = "["..plr.Name.."]: "..FilteredChat
mss:PublishAsync("Global_Chat", plr.Name.."ThIsASodONottypethsiOutYOUNOObsTrInGsEpeRaTor"..FinalMsg)
end)
end)
Help please!