How to have a variable = another variable

So I want the magnitude of a Vehicleseat to be the same number of the AngularVelocity of a hingeconstraint.
How would I do this?

This is what I tried so far, and it hasn’t worked.

I need the angularvelocity to have the same number as the magnitude so that my wheel will spin at the same speed the vehicle is going (Note the wheel isn’t on the ground, which is why it cannot roll)

Magnitude is a single number, while AngularVelocity.Velocity takes three digits in the form of a Vector3.

If you remove the .Magnitude from the end of the first line, it should function. I’m not sure if this is what you are looking to do though. You also need to set the value of your values through the objects, instead of just editing a already defined number.

1 Like

By saving the values of the magnitude and angular velocity you’re only saving numbers that aren’t of much use. Also while wait() loops are bad practice and should always be avoided if possible. Try something like this:

local vehicleSeat = script.Parent
local wheel = script.Parent.Parent.drivewheel1.the.HingeConstraint

vehicleSeat:GetPropertyChangedSignal("Velocity"):Connect(function() -- only update value when Velocity has changed
    wheel.AngularVelocity = vehicleSeat.Velocity.Magnitude

What i’m trying to do is have the wheel on my train turn at the same rate of the magnitude of the vehicleseat.

I barely know much of scripting yet but i’ll look into it.


What exactly do you mean by numbers that aren’t of much use? I was told that AngularVelocity used Vector3 so i’m confused on how to have a single number = to whatever one of the three digits.
I heard that using wait() isn’t that reliable and can sometimes break but I barely know anything about scripting in general. There were no errors in the script you suggested yet it didn’t function, and I couldn’t find anything in the Output box. Could you lighten up on what the GetPropertyChangedSignal function is and why you have to put “Velocity” in quotes? I’ll try and fix it based on what I can find.