# Magnitute.Vecolity

Hey, im making a Train currently and wanted to know how to make a Sound louder.

Lets say this is the Speed:

0 Kmh --------40 Kmh-------- 80 Kmh

0 Volume ----------5 Volume----------10 Volume

And this over me is the Volume: /\

How could i archieve that if the Speed is 40 Kmh that the Volume is 5 and if the Speed is at 60 Kmh the Volume is at 7.5.
I could do that with many if statements but can i do another way? I dont know what Magnitute Vecolity is (I thing how fast the Vehicle is going) could it work with that?
Thanks!

``````local sound = script.Parent.Sound
local partiwanttomeasurethevelocityby = script.Parent
multiplier = 1.25

sound.Volume = partiwanttomeasurethevelocityby.AssemblyLinearVelocity.Magnitude * multiplier

end
``````

actually im not sure if you need end but y’know

``````Sound.Volume =Train.Speed / 8
``````
2 Likes

Thanks to u both i will try it out now and i use VectorForce to move the Train how can i know how fast is 100 Z or X Force, i mean how could i know how much kmh is 1000 Z or X Force?
Thanks!

1 Like

you can use a conversion formula/equation

for adding up the velocity in those directions use magnitude

assemblylinearvelocity.magnitude