PlayerGui is not a valid member of Player

I’m creating a trading system in my game.
This is from the client and was ran from a remote event:

for i, v in pairs(otherPlr.PlayerGui.CoreUI.InventoryFrame.ScrollingFrame:GetChildren()) do
	if v:IsA("ViewportFrame") then
		v:Clone().Parent = script.Parent.TRADE_FRAME.TradeFrame.Plr1Scrolling
	end
end

otherPlr is not the main player!

PlayerGui is not a valid member of otherPlr

1 Like

How do you define Otherplr? the problem is that Otherplr isn’t a true player.

I printed otherPlr and it’s another player that isn’t the local player.

I think you should use WaitForChild, instead of directly referencing it

the client doesnt have access to other clients (for obvious reasons) so you’d need to use a remote event

print the (otherPlr), it’s most likely nil.

I already did reference it with WaitForChild

I did print it, it wasn’t nil.

Like I said, the client ! have access to others client side stuff. The reason it doesnt print nil is cause the userdata itself isnt client side

1 Like

I don’t quite remember, but I think other clients can see the PlayerGui of other players?

You can test it in a local host test but they dont for like I said, very obvious reasons. You wouldn’t want mr hacker giving you epilepsy right?

No, that would be an issue with game structure

The server can see all the client’s PlayerGui

Okay, that’s what I thought. I believe they implemented this fairly recently, because I remember writing a script in order to delete other plr’s player guys for the client.

1 Like

I used a remote event, but the problem was worse.

I believe the best solution is a remote function giving you a clone of their GUI.

Is there a way to send a table back to the client? Like an instance table?

Try doing local plrGui = Player:WaitForChild("PlayerGui")

local plrgui = Player:WaitForChild(“PlayerGui”)

Oops someone did it before use his his is the original Note:I didn’t copy it

You can’t access other client’s playerguis when you’re in a client script.

is this part of the client script or the server…?