Hi, and welcome! I’m looking for assistance in solving a handful of minor bugs that seem to go in tandem.
Recently I created a thread where a few developers helped me craft my ideal vehicle chassis. The only problem is that it needs to sit multiple people, however major issues arise as soon as more than one person gets in the vehicle. I’ve listed the bugs below along with gifs, I hope these can be solved. I appreciate any and all input!
**Vehicle details: **It’s a chassis using spring constrains, hinge constraints, and weld constraints. The bodykit is welded to the chassis primarypart. The driver’s seat is a classic VehicleSeat object. The other seats are simple parts that the character’s LowerTorso is glued to using a Weld. I have tested this with a normal Seat object and issues #2 and #2 do not exist, however I’m doing my best to use the system I have of normal parts so players aren’t forced into sitting in the vehicle by touching a seat on accident. The gif below is how it moves with only the driver.
A link to the place. It’s free to take. Feel free to use Studio on this place and mess around with things, everything is working the same way it does in my full game, minus the “sitting” animation. Click a neon part to sit.
VehicleHandler - ServerStorage: VehicleTest: Chassis: VehicleSeat
ClientScript - StarterGui
ServerScript - ServerScriptStorage
Vehicle Welding/Regenerating Script - Workspace: Regen
1.) When getting into the VehicleSeat, the vehicle goes haywire for a split second. (It rotated to face the way my character was facing)
2.) When another player gets in, the vehicle’s springs give out as if they weigh 100 tons, but the vehicle’s PrimaryPart is a 2x2x2 invisible part with a Density of 100 while a character is light.
3.) Once another player is seated, the vehicle will only move at a snail’s pace, something like a WalkSpeed of 0.1. The passenger will see the first image, while the driver (and server) show the second image. (The vehicle slowly moves while the wheels stay in place)
Let’s see if checking ‘Massless’ property while seated actually does anything. It’ll probably remove the extreme weight from the player.
Thanks for the response! I’ve updated one of the above paragraphs to include some info about default Seat objects (after some experimenting). Checking “Massless” does not make the issue go away.
For TL;DR, apparently the main problem is the back seats. When you weld the characters to the vehicle, the vehicle balance become unstable, as if one side is pressed down.
Patching the first problem is to make sure the vehicle doesn’t spaz out on seat by an option: Temporarily anchoring it for a half second(including loose constraint parts) and then un-anchor it, as if the engine is starting up. Only works for the first seat, uncertain about additional players in the back, perhaps limiting the seats to when the vehicle is not moving at high speeds? Then repeat the same trick but shorter durations.
Try switching out the weld from LowerTorso to HumanoidRootPart instead. Accursed animations breaks stuff sometimes. Otherwise don’t.
Not sure what to do when a vehicle is moving extremely slow. I have never tested vehicle building with constraints, maybe I’ll do it one day.
Otherwise, if all above fails, tweak the constraints.
I believe this devhub page addresses your problem in the vehicle section.
The behavior you’re seeing is reminiscent of network ownership issues on constrained parts.
Thanks for the reply! I’ve tried adding the lines below to the script, and even using :SetNetworkOwner in the command line in the Server. Having it in the script seems to have no effect, however using it in the command line fixes the wheel part of issue #3, the wheels stick to the truck.
I’ll set the player to be entirely Massless, but instead of the truck going back to evenly-loaded, the side the player is on is slightly lifted. None of these fixed the snail speed of the truck, however.
You need to change network owner of every part of the vehicle. Not just the seat.
If ownership is his problem, then OP can do this by just assigning network ownership of the root part of the assembly.
@qqtt991 I tried gathering all the parts of the vehicle in a table and then doing what’s in the code below. The wheels stuck with the vehicle, but the vehicle still moved incredibly slow. Setting the passenger to Massless had no effect.
@sircfenner I’ve tried using this line below, but it had the same outcome as what I described above unfortunately.
Just to confirm: your vehicle works as intended when there is only person, but you only begin to experience constraint issues when more than one person enters the vehicle, right?
I’ve never really worked with vehicles so I might not be able to help, but I just want to clarify this much in case some kind of stroke of luck sparks up.
Yes. Having other Seat objects attached to the vehicle seems to fix the issue, but I’m trying to maintain the current system of “click to sit” that I have in the game, where seats are normal parts you can click on, your body is welded to the seat, and you play a “sitting” animation.
All seats except for the VehicleSeat, of course.
Can you try adjusting your click to sit system to weld the HumanoidRootPart instead of the Lower Torso, and use a WeldConstraint? (Experimentation)
Using the HumanoidRootPart seems to solve the ‘stationary wheels’ part of the problem, however it still moves incredibly slow, and the springs are compressed as if the player weighs a ton.
Using a WeldConstraint had no effect other than making the ‘stationary wheels’ issue reappear.
I’ve created a bare-bones version of the system I’m using to “seat” players when they click on a seat part. The link is in the top post, feel free to go in on Studio and mess around.
Looking at the place in Studio, there are several things wrong.
Players sitting in the vehicle can still run, and this is what’s causing the slow movement. Both players are fighting for control over whether or not they’re moving. You should PlatformStand sitting characters, this allows the truck to move properly.
Also if I click many times on a seat I can do this. You should probably prevent this.
After some testing, forcing the player to PlatformStand after being welded to the seat fixes the issue entirely. Thank you so much for your help with this!