Since the chat exists locally, you need to use remote events or functions to have something display on everyone's chat. So to do this, you place a remote event in ReplicatedStorage named "SendMessage", and then in startergui, you place a local script handling the messages being sent from the server, and in your existing server script, you have a function handling the message to be sent.
Local script placed inside StarterGui:
local SendMessage = game.ReplicatedStorage.SendMessage
SendMessage.OnClientEvent:Connect(function(chatProperties)
game:GetService("StarterGui"):SetCore("ChatMakeSystemMessage",chatProperties)
end)
Your server script:
local SendMessage = game.ReplicatedStorage.SendMessage
local function say(msg)
SendMessage:FireAllClients({
Text = msg;
Color = Color3.fromRGB(0,255,215);
Font = Enum.Font.SourceSans;
FontSize = Enum.FontSize.Size18;
})
end
script.Parent.Touched:Connect(function(hit)
local h = hit.Parent:FindFirstChild("Humanoid")
if (h) then
local items = game.ReplicatedStorage.PlayerAssets[hit.Parent.Name].Inventory:GetChildren()
if #items ~= 0 then
game.ServerScriptService.StatusScript.GameStatus.Value = "Loud"
say(hit.Parent.Name.." set off the Metal Detectors!", Color3.fromRGB(0, 0, 0))
end
end
end)
If this answers your question, then mark it as the accepted answer.
3 comments
Are you trying to get a bubble over someone/something's head, or are you trying to get a message in the actual chat GUI?
In the actual Chat Gui
https://developer.roblox.com/en-us/api-reference/function/StarterGui/SetCore : ChatMakeSystemMessage