Trying to get a part to spin at rate of cars speed a-chassis

1.geting the MPH of my a-chassis car and making the DR “driveshaft” to spin at that speed
2. What is the issue? robloxapp-20200518-2249114.wmv (2.6 MB)
it doesent move when i start driving the car it stays put when i want it to move
3. What solutions have you tried so far?
i spent my hole afternoon on the dev hub and then back on studio multiple times nothing seems to be helping
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
my first attempt fail

-- script.Parent.Parent["A-Chassis Interface"].Values.Horsepower.Value.Changed:Connect(function(t)
	--script.Parent.Parent.Parent.Misc.DR.move.AngularVelocity = t
--end)

my seccond attempt

--while true do

--script.Parent.Parent.DriveSeat.Torque.Changed:Connect(function(NewValue)

-- print(NewValue)

-- script.DR.move.AngularVelocity = (NewValue)

--end)

--wait(5)

--end
if you guys want you can take the model and see if there is any problems with the model
1 Like

What Model? You didn’t post a link or the model itself.
If you don’t care about the actual rotational direction just use the magnitude of the Part. Put a Driveshaft with a HingeConstraint in it attached to the frame with the ActuatorType set to Motor and put this script into it to make it spin faster depending on the driveshaft’s speed:

local driveshaft = script.Parent.HingeConstraint
while true do
…wait(.1)
…driveshaft.AngularVelocity = script.Parent.Velocity.Magnitude
end

sorry i forgot to post the link here is the model go test your thinking
https://www.roblox.com/library/5054106784/13000-hours-of-still-not-working

Let me analyze your script first so you can see what you did wrong.

script.Parent.Parent["A-Chassis Interface"].Values.Horsepower.Value.Changed:Connect(function(t)
You’re checking how much horsepower the car is producing, not at which speed the car is going.

This line is also wrong - Values.Horsepower.Value.
You don’t need the .value part to check if a IntValue changed.

script.Parent.Parent.Parent.Misc.DR.move.AngularVelocity = t
Since the gui gets parented to the player, you’re actually checking the parent of PlayerGui and not the car itself.

At the end, your script should look like this:

local car = script.Parent.Car.Value
script.Parent.Parent[“A-Chassis Interface”].Values.Velocity.Changed:Connect(function(t)
car.Misc.Script.DR.move.AngularVelocity = t.magnitude
car.Misc.Script.DR.move.MotorMaxTorque = t.magnitude
end)

Hope this helps you, and sorry for the bad formatting.

would i put the script in a-chassis interface or in a-chassis tune?

also my question is where does magnitude come form?
and the value of car tuns into the name of the model when the game starts

also


evrything in a-chassis interface is put into player gui so now it cant find it i gess
also the values only change in the player gui so i tryed getteng it from the drive sseat no luck im about to try and get the script to find the car itsself

The new script should replace the already existing driveshaft script, since I just modified it.
I also use the .magnitude to get the speed of the car, since the velocity value of the A-Chassis is a Vector3.

I don’t understand what you mean by this.

ahhh ok imma try that right now

problem
script.Parent.Parent[“A-Chassis Interface”].Values.Velocity.Changed:Connect(function(t)
it would need to be like this to get to that XD
script.Parent.Parent[“A-Chassis Tune”][“A-Chassis Interface”].Values.Velocity.Changed:Connect(function(t)
and on start the car value is set to the name of the model by the script called drive

My script should work fine without the [“A-Chassis Interface”].
Are you sure you’re putting my script inside the A-Chassis Plugins folder?

1 Like

does it need to be a local script or regular script
and agin when the car scripts start up this happens

the script is the one you gave me
the drive shaft stays put still

It should be a local script, you could also just replace the script inside the “driveshaft” and enable it.

ITS WORKING NOWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW I JUST PUT IT IN A LOCAL SCRIPT XD thanks

thanks for helping me out here is what you helped me finish