I've been writing some code. I tested it in the regular play option in Studio and the code works find, but when I try it in Server Test mode the code breaks. I narrowed the problem down to a discrepancy between what the client receives and what the server sends back via return
if string.lower(string.sub(userInput,1, 5)) == "/cmds" then
local getAdminGui = game.ReplicatedStorage:WaitForChild("GetAdmin")
local adminContainer = getAdminGui:InvokeServer()
print(adminContainer == nil)
if adminContainer ~= nil then
adminContainer.Parent = game.Players.LocalPlayer.PlayerGui.ChatGui
Basically, this is from a LocalScript in the StarterGui. The problem stems from adminContainer being nil after the print statement. getAdminGUI is a RemoteFunction that calls a script from the ServerScriptService. The function returns a Frame with updated Childrens. When I use the print statement from above to check what the return is sending back, the print statement returns false (meaning that the return is not nil) but the client print statement (shown above) returns true. I am not sure why this is.
I thought it might be due to multithreading, but when I use wait() on a line right above the print statement on the above code the outcome stays the same.
Anyone know why this is?

2 comments
Well, seeing you used :InvokeServer(), that means you used the OnServerInvoke callback. Under any circumstances, the server should not be handling GUIs.
I am merely editing the GUI and giving it back to the client to display.