I am trying to make a command where a player types a message, and it pops up on everyone’s screen. Here is my code:
commands.shout = function(sender,arguments)
if sender:GetRankInGroup(11635716) >= 10 then
local message = table.concat(arguments, " ", 1, #arguments)
local Players = game:GetService("Players")
for i, player in pairs(Players:GetPlayers()) do
local playerGui = player:WaitForChild("PlayerGui")
local gui = playerGui:WaitForChild("ShoutGUI")
local frame = gui:WaitForChild("ShoutFrame")
local text = frame:WaitForChild("ShoutMessage")
frame.Visible = true
text.Text = message
task.wait(10)
frame.Visible = false
end
end
end
I want it to wait 10 seconds before it disappears, but I think it will cause it to wait 10 seconds between each player seeing it, so how do I fix this?