hello !
I’m currently scripting an intercom which is suppose o take the player sentence in the chat and make the server says it, so here is the script :
local zone = game.Workspace.Detection
function ListenForChat(Player)
Player.Chatted:Connect(function(Message)
local Filtered = game:GetService("TextService"):FilterStringAsync(Message, Player.UserId)
local function chat(message)
game.StarterGui:SetCore("ChatMakeSystemMessage", { Text = message, Colour = Color3.fromRGB(16, 110, 139), Font = Enum.Font.SourceSans})
end
chat(Filtered)
end)
end
game.Players.PlayerAdded:Connect(function(player)
player.Chatted:Connect(function(msg)
if zone.Touched then
ListenForChat()
end
end)
end)
Are you calling ChatMakeSystemMsg on the server, if you are, then make a remote event, fire it on clients with the message as the parameter, then make the system msg on the client.
local Zone = workspace:WaitForChild("Detection")
function PartToRegion3(part)
local abs = math.abs
local cf = obj.CFrame -- this causes a LuaBridge invocation + heap allocation to create CFrame object - expensive! - but no way around it. we need the cframe
local size = obj.Size -- this causes a LuaBridge invocation + heap allocation to create Vector3 object - expensive! - but no way around it
local sx, sy, sz = size.X, size.Y, size.Z -- this causes 3 Lua->C++ invocations
local x, y, z, R00, R01, R02, R10, R11, R12, R20, R21, R22 = cf:components() -- this causes 1 Lua->C++ invocations and gets all components of cframe in one go, with no allocations
-- https://zeuxcg.org/2010/10/17/aabb-from-obb-with-component-wise-abs/
local wsx = 0.5 * (abs(R00) * sx + abs(R01) * sy + abs(R02) * sz) -- this requires 3 Lua->C++ invocations to call abs, but no hash lookups since we cached abs value above; otherwise this is just a bunch of local ops
local wsy = 0.5 * (abs(R10) * sx + abs(R11) * sy + abs(R12) * sz) -- same
local wsz = 0.5 * (abs(R20) * sx + abs(R21) * sy + abs(R22) * sz) -- same
-- just a bunch of local ops
local minx = x - wsx
local miny = y - wsy
local minz = z - wsz
local maxx = x + wsx
local maxy = y + wsy
local maxz = z + wsz
local minv, maxv = Vector3.new(minx, miny, minz), Vector3.new(maxx, maxy, maxz)
return Region3.new(minv, maxv)
end
local Zone3 = PartToRegion3(Zone)
function ListenForChat(plr)
plr.Chatted:Connect(function(Message)
local Filtered = game:GetService("TextService"):FilterStringAsync(Message, plr.UserId)
local function chat(message)
if workspace:FindPartInRegion3(Zone3, plr.Character.HumanoidRootPart) then
game.ReplicatedStorage.YourRemote:FireAllClients(Filtered)
end
end
chat(Filtered)
end)
end
game.Players.PlayerAdded:Connect(chat)
localscript:
ChatRemote.OnClientEvent:Connect(function(message)
game.StarterGui:SetCore("ChatMakeSystemMessage", { Text = message, Colour = Color3.fromRGB(16, 110, 139), Font = Enum.Font.SourceSans})
end
Yes, except that for a beginner the depreciated message instance still works and is the fastest way to create a GUI that displays a message everyone can see without having to create a GUI, clone it, edit the specific text label that’s located somewhere in it, and then parent it inside a player’s PlayerGui.
No idea what you’re asking. Also, I forgot to mention, if your using this for an intercom system that many people will see then you’ll want to use the FilterStringForBroadcast instead of TextService.
Also, the code I provided will display the message to everyone regardless of who speaks. I recommend you learn more about scripting and all the instances you can use before attempting this.
Ok like :
I’m an random player and I want to say something, I go to the intercom and say : “Hello guys I’m ricardo”
The script take what the player said, and, because I used a proximity chat, will say it to everyone. That’s what I’m trying to do