You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
My game has a huge basis on driving. I’d like to make it to where when a player exits any vehicle that is in motion, the vehicle stops, rather than continuing to travel until ending in a collision. A Chassis Tune. -
What is the issue? Include screenshots / videos if possible!
Vehicle does not slow or stop when jumping from vehicle. I’ve attempted multiple different ideas, I’ve also used a Plugin called “Anti-Loop Plugin” and altered the script to deal with my specific issue, but no avail. The wheels in my vehicle models are anchored, I’m running out of options and searching the Dev Forum endlessly and trying all the solutions i’ve come across, but have yet found a solid working solution.
GIF of my issue below:
Roblox (gyazo.com)\ -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I started off with this placed as a Script under DriveSeat. No luck.
local carSeat = script.Parent
carSeat:GetPropertyChangedSignal("Occupant"):Connect(function()
if carSeat.Occupant then --someone using car
carSeat.MaxSpeed = 140
elseif not carSeat.Occupant then --no one using car
carSeat.MaxSpeed = 0
end
end)
I attempted using this as a local script placed into Plugins under A-Chassis Tune. Still no luck.
(From Anti-Loop Plugin)
local car = script.Parent.Parent
local _Tune = require(car["A-Chassis Tune"])
for i, v in pairs(car.Wheels:GetChildren()) do
if v.Name == "FL" then
v["#AV"].AngularVelocity = 0
v["#AV"].MotorMaxTorque = 0
v["#AV"].MotorMaxAcceleration = 1e308
end
if v.Name == "FR" then
v["#AV"].AngularVelocity = 0
v["#AV"].MotorMaxTorque = 0
v["#AV"].MotorMaxAcceleration = 1e308
end
if v.Name == "RL" then
v["#AV"].AngularVelocity = 0
v["#AV"].MotorMaxTorque = 0
v["#AV"].MotorMaxAcceleration = 1e308
end
if v.Name == "RR" then
v["#AV"].AngularVelocity = 0
v["#AV"].MotorMaxTorque = 0
v["#AV"].MotorMaxAcceleration = 1e308
end
end
car.DriveSeat.ChildRemoved:connect(function(child)
if child.Name=="SeatWeld" and child:IsA("Weld") then
for i, v in pairs(car.Wheels:GetChildren()) do
if v.Name == "FL" then
v["#AV"].AngularVelocity = 0
v["#AV"].MotorMaxTorque = 0
v["#AV"].MotorMaxAcceleration = 0
end
if v.Name == "FR" then
v["#AV"].AngularVelocity = 0
v["#AV"].MotorMaxTorque = 0
v["#AV"].MotorMaxAcceleration = 0
end
if v.Name == "RL" then
v["#AV"].AngularVelocity = 0
v["#AV"].MotorMaxTorque = 0
v["#AV"].MotorMaxAcceleration = 0
end
if v.Name == "RR" then
v["#AV"].AngularVelocity = 0
v["#AV"].MotorMaxTorque = 0
v["#AV"].MotorMaxAcceleration = 0
end
end
end
end)
function exitIsOn()
if _Tune.AutoStart == true then
for i, v in pairs(car.Wheels:GetChildren()) do
if _Tune.Config == "AWD" then
if v.Name == "FL" then
v["#BV"].MotorMaxTorque = _Tune.EBrakeForce
end
if v.Name == "FR" then
v["#BV"].MotorMaxTorque = _Tune.EBrakeForce
end
if v.Name == "RL" then
v["#BV"].MotorMaxTorque = _Tune.EBrakeForce
end
if v.Name == "RR" then
v["#BV"].MotorMaxTorque = _Tune.EBrakeForce
end
end
if _Tune.Config == "FWD" then
if v.Name == "FL" then
v["#BV"].MotorMaxTorque = _Tune.EBrakeForce
end
if v.Name == "FR" then
v["#BV"].MotorMaxTorque = _Tune.EBrakeForce
end
if v.Name == "RL" then
v["#BV"].MotorMaxTorque = 0
end
if v.Name == "RR" then
v["#BV"].MotorMaxTorque = 0
end
end
if _Tune.Config == "RWD" then
if v.Name == "FL" then
v["#BV"].MotorMaxTorque = 0
end
if v.Name == "FR" then
v["#BV"].MotorMaxTorque = 0
end
if v.Name == "RL" then
v["#BV"].MotorMaxTorque = _Tune.EBrakeForce
end
if v.Name == "RR" then
v["#BV"].MotorMaxTorque = _Tune.EBrakeForce
end
end
end
end
end
car.DriveSeat.ChildRemoved:Connect(exitIsOn)
If anyone has any thoughts or possible solutions I could attempt, please let me know. I feel like this is such an easy task but my brain shuts down each time I try to think of a way to prevent the motion from continuing.
Thank you so much!!!