In short, I am currently making a car that is powered by BodyVelocity to get it moving. And although the car works well, the problem is is that once it drives up or down the wedge, it starts flying until the player no longer accelerates. Is it possible to temporarily turn Body Movers off if the car is not interacting with any of the parts? I will provide the script for further context:

script.Parent:GetPropertyChangedSignal("Throttle"):Connect(function()
	if script.Parent.Throttle == 1 then
		script.Parent.Parent.MainPart.BodyVelocity.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
		script.Parent.Parent.MainPart.BodyVelocity.Velocity = script.Parent.Parent.MainPart.CFrame.LookVector * 95
	 elseif script.Parent.Throttle == 0 then
		script.Parent.Parent.MainPart.BodyVelocity.MaxForce = Vector3.new(0, 0, 0)
		script.Parent.Parent.MainPart.BodyVelocity.Velocity = Vector3.new(0, 0, 0)
	 elseif script.Parent.Throttle == -1 then
		script.Parent.Parent.MainPart.BodyVelocity.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
		script.Parent.Parent.MainPart.BodyVelocity.Velocity = script.Parent.Parent.MainPart.CFrame.LookVector * -85
	end
end)

script.Parent:GetPropertyChangedSignal("Steer"):Connect(function()
	if script.Parent.Steer == 1 then
		script.Parent.Parent.MainPart.BodyAngularVelocity.MaxTorque = Vector3.new(math.huge, math.huge, math.huge)
		script.Parent.Parent.MainPart.BodyAngularVelocity.AngularVelocity = Vector3.new(0, -1, 0)
	elseif script.Parent.Steer == 0 then
		script.Parent.Parent.MainPart.BodyAngularVelocity.MaxTorque = Vector3.new(0, 0, 0)
		script.Parent.Parent.MainPart.BodyAngularVelocity.AngularVelocity = Vector3.new(0, 0, 0)
	elseif script.Parent.Steer == -1 then
		script.Parent.Parent.MainPart.BodyAngularVelocity.MaxTorque = Vector3.new(math.huge, math.huge, math.huge)
		script.Parent.Parent.MainPart.BodyAngularVelocity.AngularVelocity = Vector3.new(0, 1, 0)
	end
end)

3 comments

0

wdym interacting

0

Interact, as in touching them.

0

if BasePart:GetTouchingParts() == {} then ... end