To begin, you can't use a LocalScript to change everyone's screen without using a RemoteEvent.
Second, if you change "StarterGui" it won't have any effect, it has to be the PlayerGui, which is a child of each individual player.
To start, put a RemoteEvent in ReplicatedStorage and name it "AlertEvent".
Next, inside your button put a LocalScript and write this.
local event = game:GetService("ReplicatedStorage"):WaitForChild("AlertEvent")
script.Parent.MouseButton1Click:Connect(function()
local textToSend = script.Parent.Parent.Parent.TextBox
event:FireServer(textToSend.Text)
end)
This will send arguments to the server, where we will change everyones screen, the first argument will always be the player firing the event, and then any arguments afterwards. For this example, our only argument will be the text that we want to alert.
After that, put a ServerScript inside of ServerScriptService and write this.
local event = game:GetService("ReplicatedStorage"):WaitForChild("AlertEvent")
event.OnServerEvent:Connect(function(plr,text)
for _,player in pairs(game:GetService("Players"):GetChildren()) do
player:WaitForChild("PlayerGui"):FindFirstChild("EASGui").Frame.ALERT.Text = text
wait(3)
player:WaitForChild("PlayerGui"):FindFirstChild("EASGui").Frame.Sound:Play()
player:WaitForChild("PlayerGui"):FindFirstChild("EASGui").Enabled = true
wait(30)
player:WaitForChild("PlayerGui"):FindFirstChild("EASGui").Enabled = false
end
end)
This will receive the player who fired the event, and the text we want to change. It will also loop through every player's gui and change the text, play the sound, make it visible, wait 30 seconds, and then not make it visible.
Hope this helped!
If this worked for you, let me know by selecting this as the answer!
If it didn't work, comment down below what went wrong and I'll try to help.
5 comments
Well, I forgot to say this in my original question but my textbox doesn't select when I try to type in it. It's not selecting when I click it. Text Editable is enabled
Is it a TextBox or a TextButton? If it's a TextButton, that's the problem. If it's a TextBox, try re-inserting it into the previous place.
Okay.
Actually, I don't need this GUI anymore anyways. Thanks for you help.
No problem!