So i have this server script called "Game Script" in ServerScriptService but it dosen't recognize PlayerGUI, well if i click on the play button it works but not if i upload the game and play or test the game with 2 players on studio, It's nothing wrong with the plr it's when i test with 2 players on studio then when i go the the Players tab and then on one of the players playerGUI is there but not the guis
Here's the script:
function pMsg(text, t, plr, color)
if plr ~= nil then
if plr:findFirstChild("PlayerGui") then
if plr.PlayerGui:findFirstChild("Main") then
if plr.PlayerGui.Main:findFirstChild("Message") then
if color == "Red" then
plr.PlayerGui.Main.Message.TextColor3 = Color3.new(255/255, 0, 0)
elseif color == "Green" then
plr.PlayerGui.Main.Message.TextColor3 = Color3.new(85/255, 255/255, 0)
elseif color == "Orange" then
plr.PlayerGui.Main.Message.TextColor3 = Color3.new(255/255, 170/255, 0)
else
plr.PlayerGui.Main.Message.TextColor3 = Color3.new(255/255, 255/255, 255/255)
end
plr.PlayerGui.Main.Message.Text = text
end
end
end
end
coroutine.resume(coroutine.create(function()
wait(t)
if plr ~= nil then
if plr:findFirstChild("PlayerGui") then
if plr.PlayerGui:findFirstChild("Main") then
if plr.PlayerGui.Main:findFirstChild("Message") then
plr.PlayerGui.Main.Message.Text = ""
end
end
end
end
end))
end

2 comments
Why not try :WaitForChild("PlayerGui")
Then it's infinite yfield wait or something the Guis isnt even in the playergui when you watch as the server