I’m currently learning how to mess with the new chat system and for some reason… even when i fire an event… the TextChatService fires twice.
Here’s a download of the place to mess with, and the scripts are below.
MICSETUP.rbxl (212.3 KB)
Server Script in ServerScriptService
local micEvent = game.ReplicatedStorage:FindFirstChild("MicrophoneEvent")
if not micEvent or not micEvent:IsA("RemoteEvent") then
return
end
micEvent.OnServerEvent:Connect(function(plr,userInfoFromText,msg)
warn(msg)
end)
Local Script in StarterPlayerScripts
--[[Made by Just2Terrify]]
local TextChatService = game:GetService("TextChatService")
TextChatService.OnIncomingMessage = function(msg:TextChatMessage)
if script.Parent.Name ~= "PlayerScripts" then
return
end
if not msg.TextSource or not game.Players:GetPlayerByUserId(msg.TextSource.UserId) then
return nil
end
if game.Workspace:FindFirstChild(game.Players:GetPlayerByUserId(msg.TextSource.UserId).Name):FindFirstChild("Microphone") then
local Event = game.ReplicatedStorage:FindFirstChild("MicrophoneEvent",true)
if not Event or not Event:IsA("RemoteEvent") then
return nil
end
Event:FireServer(msg.TextSource,msg.Text)
end
if msg.TextSource.UserId == 678299 or msg.TextSource.UserId == -1 then
local chatProperties = Instance.new("TextChatMessageProperties")
chatProperties.PrefixText = `<font color= "{"#FF007F"}">[The Developer]</font>{" "..msg.PrefixText}`
return chatProperties
end
end