Change map warning won't show but it shows after new map is picked?

The map changing works and all but the map warning is late and sometimes doesn’t even disappear after it pops up

--Services and variables
local RS = game:GetService("ReplicatedStorage")
local Maps = RS:WaitForChild("Maps")
local SG = game:GetService("StarterGui")
local MapWarning = SG.MapChange:WaitForChild("WarningFrame")

task.wait(1)

--Loop
while true do
for i,v in pairs(Maps:GetChildren()) do
	v.Parent = workspace
	task.wait(5)
	MapWarning.Visible = true
	task.wait(5)
	MapWarning.Visible = false
	task.wait(1)
	v.Parent = Maps
end
	task.wait(1)
end
1 Like

Won’t wait be deprecated soon tho? And I’m pretty sure task.wait is better not sure why but yea

1 Like

Actually my bad on tht one, how abt u put a print statement between the part where u make the warning visible or juz increase the task.wait val.

1 Like

You are changing the visibility of the warning inside StarterGui. You have to change it for every player for it to work.

Player.PlayerGui.MapChange.WarningFrame.Visible = true

To get all the players you can do:

local players = game.Players:GetChildren()
2 Likes

Same thing happened but now it won’t even show

while true do
for i,v in pairs(Maps:GetChildren()) do
	v.Parent = workspace
	task.wait(5)
	for i,v in pairs(Plrs) do
		if v then
			v:WaitForChild("PlayerGui").MapChange:WaitForChild("MapWarning").Visible = true
		end
	end
		task.wait(10)
	for i,v in pairs(Plrs) do
		if v then
			v:WaitForChild("PlayerGui").MapChange:WaitForChild("MapWarning").Visible = false
		end
	end
	v.Parent = Maps
end
	task.wait(1)
end

Btw Plrs is a table not the service lol

Is this in a server script?
And are you getting any errors or warnings?

This is a server script and no errors or warnings

You’re setting StarterGui’s WaringFrame.Visible to true not any players. After StarterGui is replicated to PlayerGui StarterGui has no affect on PlayerGui's.

I’d do something lik so:

local players = game:GetService("Players")
local playersChildren = players:GetChildren()
local MapWarnings = {}

while true do 
     playersChildren = players:GetChildren()
     for i, v in pairs(playersChildren()) do
           if v.PlayerGui.MapChange then
                  table.insert(MapWarnings, v.PlayerGui.MapChange:WaitForChild("WarningFrame"))
           end
    end
     for i, v in pairs(MapWarinings) do
          v.Visible = true
          --// Set visible to true then false or whatever idk what your needs are
    end
    MapWarinings = {}
end
1 Like

Let me test this in roblox studio and ill come up with a solution then

Can you show me the part of the code where you’re getting the Plrs table from?

Sure

local RS = game:GetService("ReplicatedStorage")
local Maps = RS:WaitForChild("Maps")
local Plrs = game:GetService("Players"):GetPlayers()

I don’t think thats da problem tho

Okay, if this is at the start of the script then, try putting it just after the “while true do”.
To keep the players table up to date

Edit: I did this and it started working for me

1 Like

If it worked then mark this as the answer for anyone with the same problem.