I want the car to stop when the player jumps out of it instead of just rolling away. I tried to anchor a part when the player jumps out which stops the car but the wheels will keep spinning and when getting back in you will remain the speed you had before.
You can take advantage of an event Seated
Use the seated event to detect when the player leaves the seat. You would then trigger the stopping of the car in this event.
Try this. You could change the VehicleSeat.Parent:GetChildren() to GetDescendants() if more parts are in models
local VehicleSeat = script.Parent VehicleSeat:GetPropertyChangedSignal("Occupant"):Connect(function() if VehicleSeat.Occupant then local Occupant = VehicleSeat.Occupant Occupant.Seated:Connect(function(Active) if not Active then for _, Part in pairs(VehicleSeat.Parent:GetChildren()) do if Part:IsA("BasePart") then Part.Velocity = Vector3.new() Part.RotVelocity = Vector3.new() end end end end) end end)
I tried it with GetChildren() and GetDescendants(). Both didn’t work
Is the script in the VehicleSeat? Or is there any other errors
It is in the vehicle seat and there is no error
You can add this to your Drive script, it should work nice.
_PBrake = not _PBrake – it’s probably better to put false, but it’s up to you
–this puts the car in brake, stopping it, and when the player jumps back in the car, you could take off --the brake