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.
You can't pass instances through a RemoteEvent
or RemoteFunction
. You can only pass more primitive datatypes like...
Numbers, Strings, Booleans, Tables, Vectors...
The Wiki says it at the bottom of this page: https://wiki.roblox.com/index.php?title=Remote_Functions_%26_Events