I’m sure if any of you have dealt with a-chassis vehicles, you have had the following experience: If a player exits the vehicle without putting the vehicle in park, it just drives off forever unless something stops it. I have tried many solutions to fix this and still haven’t come to any solutions that have worked. Has anyone found a way to fix this?
local carSeat = script.Parent:WaitForChild("VehicleSeat")
carSeat:GetPropertyChangedSignal("Occupant"):Connect(function()
if carSeat.Occupant then --someone using car
carSeat.MaxSpeed = 100
elseif not carSeat.Occupant then --no one using car
carSeat.MaxSpeed = 0
end
end)
More efficient implementation of the same logic. You’ll need to place the 2nd script inside the vehicle model itself. Make sure the VehicleSeat instance is a direct child of that model so that the script can correctly reference it, like this:
Alright, so I put 2 scripts in the vehicle. CarOff1 is the first script you gave, and CarOff2 is the second script you gave. The VehicleSeat name of the car is “DriveSeat” so I changed the “VehicleSeat” to “DriveSeat” on the second script. Unfortunately, these scripts don’t seem to be working.
Here are the scripts below and where I have placed them:
local carSeat = script.Parent:WaitForChild("VehicleSeat")
carSeat:GetPropertyChangedSignal("Occupant"):Connect(function()
if carSeat.Occupant then --someone using car
carSeat.MaxSpeed = 100
elseif not carSeat.Occupant then --no one using car
carSeat.MaxSpeed = 0
end
end)
Insert this script somewhere suitable within that script and control the speed however it is managed in that script. I think the MaxSpeed property only works for more primitive vehicles.
Yeah, it doesn’t work. No worries though, A-Chassis is so incredibly confusing it’s not even funny. I really appreciate the help! I’ll try and reach out to an A-Chassis dev and see if they have a solution.
To control an A-Chassis car, you change _GThrot and _GBrake in the Drive localscript.
They are controlled similarly to vehicleseat values, from -1 to 1.
Hi
if someone has a problem with the script and an error pops up, they probably have an older version of the chassis
<1.4 so if you want the script to work I recommend removing most of the script and adding
car.DriveSeat.ChildRemoved:connect(function(child)
if child.Name==“SeatWeld” and child:IsA(“Weld”) then
for i, v in pairs(car.Wheels:GetChildren()) do
v["#AV"].angularvelocity = Vector3.new(0,0,0)
v["#AV"].maxTorque = Vector3.new(2500,0,0)
end
end
end)
Is there a way to decrease the time until stopped? I know it depends on the initial speed, but is there a way to “divide” that time to make it shorter?
Hey, I just tested this and noticed that this is already in the script (I am using A-Chassis v6.52S2).
This code is at the end of Initialize script (Click to show)
--Driver Leave
car.DriveSeat.ChildRemoved:connect(function(child)
if child.Name=="SeatWeld" and child:IsA("Weld") then
--Remove Flip Force
if car.DriveSeat:FindFirstChild("Flip")~=nil then
car.DriveSeat.Flip.MaxTorque = Vector3.new()
end
--Remove Wheel Force
for i,v in pairs(car.Wheels:GetChildren()) do
if v:FindFirstChild("#AV")~=nil then
if v["#AV"]:IsA("BodyAngularVelocity") then
if v["#AV"].AngularVelocity.Magnitude>0 then
v["#AV"].AngularVelocity = Vector3.new(0,0,0)
v["#AV"].MaxTorque = Vector3.new(0,0,0)
end
else
warn('Maracujá')
if v["#AV"].AngularVelocity>0 then
v["#AV"].AngularVelocity = 0
v["#AV"].MotorMaxTorque = 0
end
end
end
end
end
end)
However, It doesn’t seems to work, the car just lose wheel force but continue foward until it stops after a long time going foward alone.
I already read some topics about this but still can’t solve this problem. Any help would be appreaciated.
Enabling parking brake when char leave vehicle seat: I’ve already tried activating the parking brake when the character leaves the DriveSeat, however this make the smoke effects on the wheels stay forever, as the drift plugin cannot remove them as the script is deleted when the player leaves the DriveSeat. So activating parking brake is not a solution also
Already tried MaxTorque = Vector3.new(X,0,0) with higher values for X but also unsucessful.
Thank you for the reply. Just tested it and still has no effect on reducing the car speed. I also tried with exorbitant values like 99999 instead of 4000 but still makes no difference.