I need to check if Text is a value, like
for i,v in pairs(game.Players:GetDescendants()) do if v.Text then print("text property is here!") end end
but actually works.
local foundText = false for i,v in pairs(game.Players:GetDescendants()) do if v.Text ~= nil or v.Text ~= "" then foundText = true print("Text property has a value of: "..v.Text) end end
If you only needed it for the Text property specifically, you could check if the instance was something that has a Text property (TextLabel,TextBox,TextButton) before referring to the property:
for i,v in pairs(game.Players:GetDescendants()) do if v:IsA("TextLabel") or v:IsA("TextBox") or v:IsA("TextButton") then print("text property is here!") end end
However, if you are using this to try and alter GUIs through a server script, it will not work. Instead, you might need to use FireAllClients() with a RemoteEvent, and check if it has the Text property in a LocalScript.