All userdata except Random and TweenInfo can be sent through Remotes

It is currently impossible to send Random and TweenInfo userdata through remote events and functions.

I’ve tested every userdata listed on the developer hub by sending each userdata object through a remote event, from both the server to client and client to server (I will attach the place file below so you can test it out yourself). Of all the userdata I tested, only Random and TweenInfo did not replicate.

Both of these should replicate because in the wiki article on Remote Events and Functions, it says,

Any type of Roblox object (Enumeration value, instance, userdata) can be passed as a parameter in a RemoteEvent firing or RemoteFunction invocation.

DataTypeRep.rbxl (14.7 KB)

[Edit]: I just remembered that newproxy is a userdata as well. I tested it and it also doesn’t go through remotes. I’m not sure if this should go through, but it would be nice to be able to send newproxys through remotes as unique objects…

8 Likes

I thought you could only send strings, bools, ints, and objects that exist on both the client and the server?

Either way, there are workarounds if you need to send this info. Like converting them to strings, bools, and ints :wink:

Well, the documentation says that all userdata should be able to be sent, so I don’t think we should settle with workarounds.

P.S. You should read up on what you can send through remotes. I noticed you didn’t list tables… sending tables through remote events can be really useful sometimes.

2 Likes

Yeah, I just forgot to list tables. There’s tons of other things. I looked at devhub and you seem to be right:

Any type of Roblox object (Enumeration value, instance, userdata) can be passed as a parameter in a RemoteEvent firing or RemoteFunction invocation. Lua types (such as numbers, strings, boolean) can also be passed, although there there are some limitations on how data can be passed.

1 Like

it would be nice to be able to send newproxys through remotes as unique objects…

Do you mean that you would like them to be received as metatable-less userdata? You could always just pass tostring(userdataValue) to get a 1-to-1 mapping between strings and userdata, which could act as such a unique object.

Passing metatables over the network would not make sense as this would basically lead to arbitrary Lua execution on the server (when the functions would be replicated). Server-to-client metatable replication could be more secure, but it would result in the API being asymmetrical, and would also be difficult to implement (taking closure variables of metamethods into consideration, etc.).

Yes, that’s what I meant. I guess using tostring should work for now

Hi, I’m also having issues with this as I recently discovered that TweenInfo can’t be sent through the network.

It’s inconvenient and inconsistent base on what is stated in the wiki and how it works now

4 Likes

I also recently came across this issue, as I use a Random object on the server, and new players who join can’t have the current state of the object sent to them over remote.

1 Like

I’ve been wondering about this, as my newproxy is not sending through Remotes.

1 Like

That does not work for Random. As far as I can tell, there is no way to find the internal state to make a copy across the client/server boundary. But there should be.

1 Like