How To Prevent IAS Replication

Hi, I need some advice concerning InputActionService (IAS)

Context

I am making a server-authoritative custom character controller (unrelated) that uses IAS to control the movement, like finding the moveVector. Currently, I find a rawMovementVector from a InputBinding that uses a Direction2DState with the keybinds WASD as forward, left, down, right, etc.
image
Then, I convert that into a trueMovementVector on the client that aligns with the direction of the camera, and fire trueMovement to update its value
image
All that logic works out well

From my understanding, all InputActions are automatically replicated from the client to the server(?). The issue is, I will never use rawMovement on the server, I only use it for client-side computation that is then moved into trueMovement. So it feels a bit wasteful to continuously replicate something I will never read from. This is some of the things I’ve thought of, but somewhat failed:

  1. I dont want to collapse both InputActions into a singular one, since it might turn into a race condition, and from my tests it didn’t fair very well
  2. I couldn’t move it into a location (like PlayerScripts) that the server couldn’t access, returning the error Unknown action nil
  3. I set rawMovement’s Enabled to false (disabled it) in the studio, then enabled it only on the client. I think this worked, but this would replicate useless instances to the server anyway
  4. I could probably make the inputAction completely client-side by creating the instance at runtime, but I think the virtue of instances is that its easier to edit since its organized in the explorer (else a table would literally do the exact same thing)

Does anyone have a more idiomatic solution that I’m missing, or maybe one I didn’t see in the docs?

Please don’t give me a response like “Don’t use IAS” since Roblox seems pretty adamant that they are phasing out CAS in favor of it—im just trying to make it work;;;

Thanks for reading!

What if you clone and destroy the original on the client? Does it still replicate then?

That was an interesting approach, just tested it: unfortunately it also returns Unknown action nil :disappointed_face:

Sorry, what part is giving this message? Does Roblox print that when the game starts, at each input, does it spam it? If that’s popping up, is it blocking IAS from working on the client?

This is the error:
image
It is thrown whenever I press any of the following keybinds:


You can see that there is no file-line reference, because the error is not thrown within my code, but within the instance itself. I guess because the clone lacks its unique server-side instance to replicate to?

You shouldn’t be worrying about this unless you can prove that input replication is actually having a negative impact on your game’s network usage. Roblox is likely already internally being incredibly efficient about how this is replicated to begin with.

I don’t get this error at all with client clones in Studio or live servers. Are you doing something else with IAS? You mention

Have you tried putting breakpoints/prints to see if the errors happen at the time of original raw input or when you send it to the real action?

You can compile it and create it on the client.
You can use my plugin (free and open source) to do that.
Build a tree of instances in Studio Explorer, select the highest one in the hierarchy, and press Convert and copy/save code.

No, that error appeared when just cloning the instance on the client and pressing the keybinds. I removed the other functionality (move to trueMovement) when testing it since I didn’t want to obscure what I was actually testing (client-side inputActions)

Edit 1: I’ll try to replicate it again when I’m free later today, then I’ll edit this with more information of my test

Edit 2: I added it in another post to reply to others as well

Thanks for your response! I tested it once more, but the error persists (without any files running, just cloning the instance using the console during runtime on the client). Can you show me what you are doing to make it work?

And like the previous message, I removed all of the complex functionality (moving data between true & raw moveDirections). It is just reading the Direction2D input.

I find that resource interesting and I’ll consider it in the future! But here I’m not sure it is entirely relevant. The issue I face is not one of the manual labor of moving instances to be in a file or being physically able to make a client-side inputAction, but instead how I face the Unknown action nil error whenever pressing any of the keybinds of the client-side inputAction (which, the plugin wouldn’t solve)

Also, I already have a “solution:” disabling the inputAction during edit-time, enabling it solely on the client-side (as I said in my original post). The initial purpose of me asking this question was for a

so something that is more obvious in behavior than doing that

Edit: I forgot to respond to Reapimus my fault*

Thats a good point, I guess premature optimization is the root of all evil. Yeah, I for sure was misguided in my concerns in my original post, so thanks for catching that. Even so, I would like to find an answer since it feels like there should be a way to stop replication in a better fashion, since its just adding complexity (added behavior of replication) for what I find to be no good reason

I made another clone, changed its key and made it print when pressed. This is a model I’m using with the Bool type:
clonedActionExample.rbxm (2.5 KB)
I tried disabling all Studio beta features (I had all but 2 enabled) and it still didn’t error.

Thanks, from this I found the issue. Since I was working with a

character, it made me enable

Workspace.UseFixedSimulation
Workspace.StreamingEnabled
Workspace.PlayerScriptsUseInputActionSystem
Workspace.NextGenerationReplication

in my place. The important one was NextGenerationReplication which led to the automatic replication;;; I’ll set your response as the solution!

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