#announcement system

3 messages · Page 1 of 1 (latest)

full yew
#

hello! im trying to make an announcement system. i think the problem may be the fact that a specific team has different guis (king has king gui and civilian has civilian gui). the king has a message typer and the civilian has the announcement show up when the king hits send. here are my two scripts:

script when leader hits send:

    print(script.Parent.Parent.TextBox.Text)
    game.ReplicatedStorage.Announced.Value = script.Parent.Parent.TextBox.Text
    script.Parent.Parent.TextBox.Text = ""
    script.Parent.Parent.TextBox.PlaceholderText = "Sent."
    wait(0.75)
    script.Parent.Parent.TextBox.PlaceholderText = "Type announcement here"
end)```

script for civilian that runs when the "Announced" value changes:
```local player = game.Players.LocalPlayer
local gui = player.PlayerGui.CitizenGui.framed.announcements.output

game.ReplicatedStorage:FindFirstChild("Announced").Changed:Connect(function()
    local announcement = game.ReplicatedStorage.Announced.Value
    local thetext = gui.TextLabel
    thetext.Text = announcement
    gui.Visible = true
    wait(8)
    gui.Visible = false
end)```

any help would be greatly appreciated!
#

PS, the "print" in line 2 for the leaders script is just so i can see the script works, and i have checked and the replicated storage value does change.

shy rivet
#
local player = game.Players.LocalPlayer
local gui = player.PlayerGui.CitizenGui.framed.announcements.output

game.ReplicatedStorage:FindFirstChild("Announced"):GetPropertyChangedSignal("Value"):Connect(function()
    local announcement = game.ReplicatedStorage.Announced.Value
    local thetext = gui.TextLabel
    thetext.Text = announcement
    gui.Visible = true
    wait(8)
    gui.Visible = false
end)