Send whole CFrame to RemoteEvent or components?

Hello. I have a simple question: Which is better for network speed, sending a whole CFrame to a RemoteEvent, or sending the CFrame components as number arguments?

1 Like

You can convert CFrame values into a table then send it to wherever is the destination. It’s a small table so I think it doesn’t affect the network that much

https://create.roblox.com/docs/reference/engine/datatypes/CFrame#GetComponents

Yes I know, don’t worry. I am wondering if it’s more optimized to just send the CFrame.

I don’t see a problem with just sending the CFrame. Is there not a view tab for checking script performance? Remember, you have resources at your disposal!

Is there a feature that lets you individually see the statistics of each :FireServer()???

No, but what you could do is compare performance both when you’re sending over the values or when you’re sending the CFrame as a whole. Whatever has a lesser percentage is what you do.

Yeah that sounds like a chore. I’ll wait a while to see if anyone else has had this same question. If not, I’ll mark your post as the solution.

1 Like

You can look at your network send by opening performance stats with ctr + f6 or through the esc menu. In my experience it doesn’t matter. When you send a CFrame over a remote event, Roblox only needs to send the 12 components of that CFrame, so sending the components individually doesn’t really change the amount of data you’re sending.

CFrames only take up a couple dozen bytes anyway, so unless you’re sending dozens upon dozens of CFrames every frame for a long amount of time, it won’t matter (assuming your network send isn’t taken up by anything else). I routinely send 15 CFrames in a table every frame for a few seconds at a time, and my network send averages around 20-30 kb/s. I’ve even tried compressing CFrames into fixed-point base-94 strings and converting that into a buffer, but the network send barely seems to change, if at all (although I think when I tried the buffer approach, I was still packing the buffers into a table instead of sending one big buffer; I’ll try that and see if that makes any difference because tables take up a bit of extra memory).

In conclusion, save yourself some worry and just send the CFrames directly. Roblox seems to already send the bare minimum data required for CFrames anyway.

Edit: by the way, you only need to send 9 of the 12 components of a CFrame because you can just calculate the ZVector by doing XVector:Cross(YVector).

1 Like

Pack position and rotation into f32 (float).
Either through buffer or through string pack
Here is a tutorial in case you need to understand them:

Please do not spread misinformation on DevForum.

i could be wrong but im pretty sure remote events send the max amount of data for a value no matter the size, for example {1, 2, 3} would be the same size as {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}

Thanks. I will just send the CFrame from now on.

There’s a plugin for this, look into Packet Profiler by @PysephDEV! It works by estimating the bytes of each datatype that you send with :FireServer().

The basis for the estimation can be seen from this post, but some values are outdated so I recommend reading into this Github file.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.