Hello, I’m currently trying to access another clients PlayerGui through another client. I have a remote function that fires to the server with the client asking for the data and the name of the player. The server then fires the remote function to the name of the player and returns their gui. In the server the value returns as the gui. However, when the client who asked for the data receives it, it is nil.
The function that asks for the data within the client:
local joinGUI = script.Parent.Parent
local gui = player.PlayerGui.MainLobby.Background
local createdLobby = game.ReplicatedStorage.LobbySystem.RetreivingLobbyInformation:InvokeServer(joinGUI.PlayerName.NameOfPlayer.Text)
if createdLobby then
--Adds all players inside the current lobby
for _, joinedPlayer in pairs(createdLobby.JoinedPlayers:GetChildren()) do
if joinedPlayer:IsA("Frame") then
local clone = joinedPlayer:Clone()
joinedPlayer.Parent = script.Parent.JoinedPlayers
end
end
gui.CreatedLobby.Visible = true
gui.CreatedLobby.Join.Visible = false
end
The server side:
folder.RetreivingLobbyInformation.OnServerInvoke = function(firedPlayer, lobbyOwner)
local lobbyOwner = game.Players:FindFirstChild(lobbyOwner)
if firedPlayer == nil then return end
if lobbyOwner then
local information = folder.RetreivingLobbyInformation:InvokeClient(lobbyOwner, firedPlayer)
print(information)
return information
end
end
The receiving client side:
game.ReplicatedStorage.LobbySystem.RetreivingLobbyInformation.OnClientInvoke = function(firedPlayer)
return createdLobby
end
Like I said when the server prints information it returns with the value, but somehow it returns nil when it returns it back to the client.