Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Can't access frame that is in playergui returned through remote function?

I have the remote function:

local event = game.ReplicatedStorage.Work.genhud

local function genHUD()
	local jobHUD = game.ReplicatedStorage.jobHUD
	local hud = jobHUD:Clone()
	hud.Parent = player.PlayerGui.mainHUD
	return hud
end

event.OnClientInvoke = genHUD

But whenever I call it in a server script, it says that hud is nil for some reason?

local event = game.ReplicatedStorage.Work.genhud

script.MouseButton1Click:Connect(function()

local hud = event:InvokeClient(player)
print(hud)

end)

Should I add that this event works perfectly in studio, it just doesn't work in game.

1 comment

0

the reason why it's printing nil is because the server can't see a player's gui, rather once it is cloned and you know it's cloned there's no reason to return any value

1 answer

This discussion is preserved as it was. New answers, comments, and votes are closed.