Hi, im trying to do a cross-server announcments. It kinda works, but it doesn’t work in other servers, I’ve looked out for a post like this and found one, but the problem was filtering stuff which isn’t like my problem. here is the code, any help is appreciated!
game:GetService("Lighting"):WaitForChild("CreatorFolder"):WaitForChild("Announcement").OnServerEvent:Connect(function(Player,Message)
if Player.UserId == 105761381 then
if Message ~= "" and Message ~= "nil" and Message ~= nil then
local MessagingService = game:GetService("MessagingService")
MessagingService:SubscribeAsync("AnnouncmentService",function(Message)
for i, v in pairs(game.Players:GetPlayers()) do
local Gui = Instance.new("ScreenGui", v.PlayerGui)
Gui.Name = "Announcement"
local TextLabel = Instance.new("TextLabel", Gui)
TextLabel.BackgroundColor3 = Color3.fromRGB(85, 0, 0)
TextLabel.BorderColor3 = Color3.fromRGB(47, 0, 0)
TextLabel.BorderSizePixel = 3
TextLabel.Size = UDim2.new(0.594, 0,0.127, 0)
TextLabel.Position = UDim2.new(0.202, 0,-0.15, 0)
TextLabel.Text = tostring(Message.Data)
TextLabel.Font = Enum.Font.Arcade
TextLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
TextLabel.TextScaled = true
TextLabel.Name = "Message"
local Alarm = Instance.new("Sound", TextLabel)
Alarm.SoundId = "rbxassetid://6199410810"
local Title = Instance.new("TextLabel", TextLabel)
Title.Name = "Title"
Title.TextColor3 = Color3.fromRGB(255, 255, 255)
Title.Text = "Announcement"
Title.BackgroundColor3 = Color3.fromRGB(85, 0, 0)
Title.BorderColor3 = Color3.fromRGB(47, 0, 0)
Title.BackgroundTransparency = 1
Title.Size = UDim2.new(0, 619,0, 13)
Title.Position = UDim2.new(-0.007, 0,-0.009, 0)
Title.Font = Enum.Font.Arcade
Alarm:Play()
TextLabel:TweenPosition(UDim2.new(0.202, 0,0.057, 0))
local waittime = coroutine.create(function()
wait(20)
Gui:Destroy()
end)
coroutine.resume(waittime)
--TextLabel.Position = UDim2.new(0.202, 0,0.057, 0)
end
end)
MessagingService:PublishAsync("AnnouncmentService",Message)
end
end
end)