When I do a FireServer with a table containing functions as a parameter, the server script doesn't receive the functions.
Example :
Local script :
local test = {
text = "text";
function1 = function()
print("function1")
end;
}
local re = game.ReplicatedStorage:WaitForChild("RemoteEvent")
re:FireServer(test)
Server script :
game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(player, test)
print(test.text)
test.function1()
end)
It does print the text, but it is unable to find the function.
The error message is : attempt to call field 'function1' (a nil value)
Am I doing something wrong? If not, is there a way to avoid this problem?

2 comments
Would this still be the ideal solution if I'm passing an object (custom object) as a parameter? It feels wrong to rewrite methods. In the example, I used a normal table just to simplify the question
What do you mean by custom object? An Instance, table, custom userdata, etc.?