'vector too long' error message ruining my game

There was no issues with my game, Rampant: Blade Battleground, concerning ‘vector too long’ until just a few days ago. This error is causing players in my game to not be able to play after performing certain actions, which was never reported by any of the thousands of players that played the game for weeks. I’m assuming this is the result of a Roblox update because I found an older DevForum post about the same issue.

Please help, the playerbase is being impacted drastically because of this error. No parts of the affected code has been changed for weeks and only now did this error start happening

Expected behavior

Using :PivotTo() to move models should not result in this bug

5 Likes

Thanks for the report! We’ll follow up when we have an update for you.

2 Likes

Okay, I’m assuming that you’re calling out PivotTo as the culprit because it’s the most interesting method on line 14374 (…I hope some of that script is auto-generated :wut:). Given that info:

  • This is a very generic error (could be triggered almost anywhere in the codebase) so it’s going to take some work to isolate what specifically is going wrong, don’t expect a fix right away (for your planning purposes).

  • Could you update the script in question such that the PivotTo is the only thing happening on the line in question (no other . or :), so the line looks like this: object:PivotTo(target). I want to confirm that the issue is actually happening as part of the PivotTo call and not something else on that line.

  • How large / complex is the model you’re calling PivotTo on in this case? Could you share the model?

  • Is it difficulty to break the ClientManager.Client script into multiple pieces? 20,000 lines should probably still be fine, but excessively large single scripts can cause interesting issues at times.

3 Likes

I type all my code myself :grinning:

I’ve wrapped that line in a pcall to prevent it from erroring and interrupting gameplay but the issue still occurs so it’d be wonderful if it could be addressed especially for other developers.

What I’m trying to move with PivotTo is a clone of a player’s character.

That would be pretty difficult - how many lines would lead to issues? I’ve made games under the impression that scripts had no limit to how large they could be.

1 Like

that script is a module script with a little over 23,000 lines now

1 Like

Because there are a lot of local variables at the top of the module that all of the code shares? If not you should be able to break out some of the largest functions / snippets into sub-ModuleScripts underneath the main one.

For an example issue, there is a practical limitation in the engine that scripts can’t be over 200,000 characters, which you’re probably getting close to at 23,000 lines. And there’s a limitation that you can’t have more than 250 local variables in a single scope, which you’re probably also close to reaching in the toplevel scope for this script.

Generally you’re “supposed” to be able to use as large a script as you want but as with everything in life nothing is actually unlimited, with a script that big you may start to run into practical limitations.


I wouldn’t expect any issues moving a character, so I don’t have an initial guess of what’s wrong.

Is there an easy way to trigger the codepath in question? I gather the error happens on the client since the problem is in a “Client” module, so I can actually connect to the game with an instrumented client and see exactly what breaks but I need clear instructions on how to trigger the error.

2 Likes

Unfortunately even I don’t know how to properly trigger the error. The issue only occurs for certain users and this is the only instance where PivotTo() errors in the game.

The bandaid fix is to wrap it in a pcall so the gameplay isn’t interrupted but I’ll definitely reduce my scripts into more modules if that’s the case.

1 Like

It’s 700,000+ characters :sweat_smile:

Way over 200,000 but things seem to run fine for the most part. Maybe it’s because everything is inside functions?

1 Like

Ah that limit probably got bumped up a bit.

RE: The other point. I know that you can’t reliably trigger it… but I mean what action is trying to run that line of code. What do I have to do in your game to get that line of code to run to even try to trigger it?

1 Like

Stun another player and bring them below the execute threshold, which is usually 40HP for most weapons. Then press the execute keybind to execute them after the prompt for it shows up. If the bug occurs the enemy player will look as if they disappeared because their cloned character didn’t get CFramed properly.

1 Like

from what I know as of now it only happens to players and not NPCs so it can’t be reproduced in the training room

1 Like

Can you add a keybind to the game which lets me directly stun the nearest player whenever I want even if they aren’t below the threshold if it’s my account (UserId = 1542153388) so that I can easily give reproducing this a shot? (I’ll use it against another account of mine to avoid disrupting people’s gameplay)

1 Like

You can test it out in the worksite place here, it’s a cloned version of the main game: Rampant [WORK SITE] - Roblox

the 2nd ability of Mecha Academia Lance (a free weapon) stuns people instantly so you can use that to perform executes efficiently

1 Like

Looks like this has been resolved here "vector too long" error?

Thanks again for the report!

1 Like