"PlayerGui is not a valid member of sky"?

I am making a script that when a music function is called, it changes UI on the players.

	for i,v in pairs(game.Players:GetChildren()) do
		local get = game:GetService("MarketplaceService"):GetProductInfo(thisfunctionssong)
		v.PlayerGui.MusicTips.Hint.Text = get.Name
	end

As I see it, the script should work, but for whatever reason, it shows something about the sky.

image

As far as I know, the sky has nothing to do with the players and is not placed into it.

PS: I tried adding a :IsA("Player") but that just made it so that the script does not function and no errors are visible.

It looks like you have a Skybox in Players for some reason. I’d figure out what’s creating that but the quick solution is to use :GetPlayers() instead of :GetChildren()

Also, it’s best practice to modify Guis on the client, not the server. I’d recommend using a RemoteEvent instead

2 Likes

I don’t think you can even modify GUIs from the server.

Do not understand the sky thing, but :GetPlayers() worked! Thanks!

Guis are cloned from StarterGui on the server instead of locally now, so you can, it’s just not advisable

1 Like

He meant that you stored a skybox in the Players service. The reason :GetPlayers() works is because it only returns the players, not the children.

No, but there wasn’t a skybox in there, and no scripts added it.

The error won’t say that it’s a sky unless some script actually added it. It might be a plugin that added it when you tested.

Maybe. But all my plugins are official, so I don’t know.