Hello all! So I have been trying to make a :sm command which shows a server message which should pop up to players which currently works. But it has one issue. The executor of the command instantly sees the server message pop up as a gui but any other player has a delay with it and the gui on their screen delays a few seconds. Does anyone know how I can fix my script below to prevent this? Thanks!
-- Command Format - :sm <Message>
-- Change Settings Here:
local groupId = 15257297
local minimumRankToUseCommand = 16
--------------------------------------
game.Players.PlayerAdded:Connect(function(plr)
if plr.Team == "Host" or "Co-Host" or plr:GetRankInGroup(groupId) >= minimumRankToUseCommand then
plr.Chatted:Connect(function(msg)
local split = msg:split(" ")
if split[1]:lower() == ":sm" then
if split[2] then
local plrTable = game.Players:GetPlayers()
for i, v in pairs(plrTable) do
v.PlayerGui.ServerMessage.MainFrame.Message.Text = string.sub(msg, 4, #msg)
v.PlayerGui.ServerMessage.Enabled = true
wait(6)
v.PlayerGui.ServerMessage.Enabled = false
end
end
end
end)
end
end)