im trying to make it so that when i touch a part, a message in the chat shows for every player from every server. it only shows the message for everyone in one server where the part is touched, but not showing up across servers. i’ve tried different arrangements for the code, but all of them have given me the same result.
--Client Script
local cs = game:GetService("CollectionService")
local rs = game:GetService("ReplicatedStorage")
local delay = 1
local sendMessage = true
for _, v in cs:GetTagged("Completion") do --Get every tagged part
v.Touched:Connect(function(hit) --If a tagged part is touched
local hum = hit.Parent:FindFirstChild("Humanoid")
local char = hum.Parent
local message = char.Name .. " has completed the " .. v.Name --Message to send in chatbox
if hum then
if sendMessage == true then
local chatMessage = game.StarterGui:SetCore("ChatMakeSystemMessage", --This sends a chat in the chatbox, you can customize the chat and what it says
{
Text = "[GLOBAL]: " .. message,
Color = Color3.fromRGB(95, 0, 173),
Font = Enum.Font.SourceSansBold,
TextSize = 18
}
)
rs.SendMessage:FireServer(chatMessage) --Fire event to server
sendMessage = false
task.wait(delay)
sendMessage = true
end
end
end)
end
--Server Script
local ms = game:GetService("MessagingService")
local cs = game:GetService("CollectionService")
local rs = game:GetService("ReplicatedStorage")
ms:SubscribeAsync("Announcement", function(msg) --Subscribe to topic
rs.SendMessage.OnServerEvent:Connect(function(player, chatMessage) --Get chat message from local script
msg.Data = chatMessage --Set data to chat message
ms:PublishAsync("Announcement", chatMessage)
end)
end)
also i have posted about this similar problem, but i wanna see if i can get new answers. any help will be greatly appreciated