Announcement System not working

Hello, my name is verycooltiger and I’ve tried making an announcement system that works with a GUI. It’s basically where if you type into the announcement box and press enter, it’ll fire a RemoteEvent that will show the announcement to everyone in the game. But recently when I tried to test it out, it didn’t work and I was wondering if anyone could help me figure out why.

Also, there is a RemoteEvent named “CreateAnnouncement”.

Message Box LocalScript:

local Cooldown = script.Parent.Parent.Announce.Cooldown

script.Parent.FocusLost:Connect(function(enterPressed)
    if enterPressed and script.Parent.Text ~= "" and Cooldown.Value == false then
        Cooldown.Value = true

        game.ReplicatedStorage.CreateAnnouncement:FireServer(script.Parent.Text)

        script.Parent.Visible = false
        script.Parent.Text = ""

        for i = 10, 0, -1 do
            script.Parent.Parent.Announce.Text = i
            wait(1)
        end

        Cooldown.Value = false

        script.Parent.Parent.Announce.Text = "📢"
    end
end)

Announce / Open button Localscript:

script.Parent.Activated:Connect(function()
    if script.Parent.Cooldown.Value == false then
        script.Parent.Parent.MessageBox.Visible = not script.Parent.Parent.MessageBox.Visible
    end
end)

Server side:

game.ReplicatedStorage.CreateAnnouncement.OnServerEvent:Connect(function(player, text)
    for , v in pairs(game.Players:GetPlayers()) do
        v.PlayerGui.SpawnPanel.AnnounceFrame.Visible = true
        v.PlayerGui.SpawnPanel.AnnounceFrame.Announcement.Text = tostring(text)
    end

    task.wait(7)

    for , v in pairs(game.Players:GetPlayers()) do
        v.PlayerGui.SpawnPanel.AnnounceFrame.Visible = false
        v.PlayerGui.SpawnPanel.AnnounceFrame.Announcement.Text = ""
    end
end)

Thanks!

To fill you all in, I am making a gameshow game where we will host an event, this is for the game Simon Says. If you need, I can message you the game and can explain more thoroughly about the issue.

How exactly are you having them “press” the button? Also are there any errors?

The part that says “Announce / Open button” part in the script is basically just opening the Message Box. The Message Box is for putting in your announcement.

Does the open part work?
And have you tried debugging?
I’m confused on what’s wrong.

Yes, once opened, there is a message box to type the announcement. After you have typed in the announcement, when you tap “Enter”, it is supposed to show an announcement through the entire server, but it only shows for other people on the same team who can also post announcements.
image

You can see it yourself, and other people on the team can see it, but not other teams and players.

hmm have you tested it with multiple people?

Yes, multiple clients and multiple people.

Edit: By multiple clients, I mean in studio where there is a tab where you can spawn in 3 clients to a server.

How would I be able to fix this? I am thinking it may have to do with the fact that only people on the Hosts team can access the announcement creation system and it somehow connects to the main system, not sure though.

Okay so sorry for the late response just busy.
to confirm - the announcement work for your side and your team, but not for the other teams? correct? I need to confirm this so i can locate the part of your code that is not working.

Also, how do the teams work, is it the roblox built in teams or a custom system?

Yes, it is using the Roblox Teams System. and the announcement will only work for anyone on the Hosts team instead of player or lobby.

1 Like

Can I see the team’s code or whatever you are using to class?

Of course, I am new to scripting and this part was coded by a friend, so this may not be it, apologies and I will ask him to verify where it is if not, thanks!

local Host = game.Teams.Host
while task.wait(0.01) do
	script.Parent.Enabled = game.Players.LocalPlayer.Team == Host
end

Have you tried to make the server do :FireAllClients() and then making a dedicated local script that makes the announcement visible as well as changing the text when it receives the event? You can pass the text as a variable like this :FireAllClients(announcementText)

No, I’ll try it tomorrow, thanks. Will update.

Well that’s obvious kind of?
It’s only running on the host team so make it so it can run on the other teams by in the code adding other teams and the host?

Got it, thanks! It took a few attempts but it worked.

1 Like