Help with remote function

I have created a remotefunction that when fired to the server it creates to parts and returns them back to the client, only problem is the client seems to not get them. Why?

client

local LHand,RHand = Rstorage:FindFirstChild('Events'):FindFirstChild('GenerateHands'):InvokeServer()

Server

-- services
local players = game:GetService('Players')
local runService = game:GetService('RunService')
local UserInputService = game:GetService('UserInputService')
local Rstorage = game:GetService('ReplicatedStorage')

-- events
local events = Rstorage:FindFirstChild('Events')
local generateHands = events:FindFirstChild('GenerateHands')

-- modules
local modules = Rstorage:FindFirstChild('Modules')

local setups = require(modules:WaitForChild('Setups',5))


generateHands.OnServerInvoke = setups.SetupHands

the module

local module = {}

module['SetupHands'] = function(player:Player)
	local LHand = Instance.new("Part")
	LHand.Size = Vector3.new(0.5,0.5,0.5)
	LHand.Parent = player.Character
	LHand.CanCollide = false
	local RHand = Instance.new("Part")
	RHand.Size = Vector3.new(0.5,0.5,0.5)
	RHand.Parent = player.Character
	RHand.CanCollide = false
	
	RHand:SetNetworkOwner(player)
	LHand:SetNetworkOwner(player)
	
	warn(LHand,RHand)
	
	return LHand,RHand
end

return module

it probably has something with the whole module thing but I dont know so here we are asking!
Thanks!

Roblox objects can’t be sent over the network directly through RemoteFunctions or RemoteEvents. Instead, you typically send data that the client can use to create or manipulate objects on their end.

1 Like

Server side:

module['SetupHands'] = function(player:Player)
    local LHand = Instance.new("Part")
    LHand.Size = Vector3.new(0.5,0.5,0.5)
    LHand.Parent = player.Character
    LHand.CanCollide = false
    local RHand = Instance.new("Part")
    RHand.Size = Vector3.new(0.5,0.5,0.5)
    RHand.Parent = player.Character
    RHand.CanCollide = false
    
    RHand:SetNetworkOwner(player)
    LHand:SetNetworkOwner(player)
    
    -- Return the information needed to create a representation on the client
    return LHand.Position, RHand.Position, LHand.Size, RHand.Size
end

Client side:

local LHandPosition, RHandPosition, LHandSize, RHandSize = Rstorage:FindFirstChild('Events'):FindFirstChild('GenerateHands'):InvokeServer()

-- Now create the hands on the client
local LHand = Instance.new("Part")
LHand.Size = LHandSize
LHand.Position = LHandPosition
LHand.Parent = game.Workspace -- or wherever it should be locally
LHand.CanCollide = false

local RHand = Instance.new("Part")
RHand.Size = RHandSize
RHand.Position = RHandPosition
RHand.Parent = game.Workspace -- or wherever it should be locally
RHand.CanCollide = false