Help with invite Player cloning onto their screen

Hello, i have a script where there is a player list a when u click on invite it searches for the player in game.Players by looking for the Text Value or name, when i invite myself it shows on my screen but when i invite someone else i get this error, any help?

Script

script.Parent.MouseButton1Click:Connect(function()
	if script.Parent.Parent.Parent == script.Parent.Parent.Parent then
		local PlayerName = script.Parent.Parent.PlayerName.Text
		local FindPlayer = game.Players:WaitForChild(PlayerName)
		local CloneGui = script.Parent.Parent.Parent.Parent.Parent.Invited:Clone()
		CloneGui.Parent = game.Players:WaitForChild(script.Parent.Parent.PlayerName.Text):WaitForChild("PlayerGui").ScreenGui
		CloneGui.Position = script.Parent.Parent.Parent.Parent.Parent.AfterCreated.Position
		CloneGui.Visible = true
	end
end)

Error Image

Seeing this as a local script, you can try passing the information using RemoteEvents.

but do u know why it errors? i dont understand why

You can’t access other players PlayerGui’s through the client. You should use a remote event as @DUK130 said so that you can access this.

If you did not have used RemoteEvents for this, in your end the invited player will not appear, causing another problem.
Also, there’s no need to search for the player if you already created a variable storing it called “FindPlayer”.

could u help me pass through Information? i did this for when a player is invited

local Remote = game:WaitForChild("ReplicatedStorage"):WaitForChild("MatchmakingRemote"):WaitForChild("SendInvite")

script.Parent.MouseButton1Click:Connect(function(Player)
	if script.Parent.Parent.Parent == script.Parent.Parent.Parent then
		local PlayerName = script.Parent.Parent.PlayerName.Text
		local FindPlayer = game.Players:WaitForChild(PlayerName)
		Remote:FireServer(Player, PlayerName)
	end
end)

and this on the server side

local Remote = game:WaitForChild("ReplicatedStorage"):WaitForChild("MatchmakingRemote"):WaitForChild("SendInvite")

Remote.OnServerEvent:Connect(function(Player, PlayerName)
	local CloneGui = game:WaitForChild("ReplicatedStorage"):WaitForChild("MatchmakingRemote"):WaitForChild("Invited")
	CloneGui.Parent = game.Players:WaitForChild(PlayerName).PlayerGui.ScreenGui
end)

im trying to make it where it saves the player who invited them and who got invited through the remote event