Im currently scripting a locomotive and I want to try and find out how much power to give it (via a value) But all my parts have mass in them and the mass values are different.
Basically what im trying to do is get the mass of every part, whether a mesh part, union, base part, any part that has a Mass property, and add up the numbers to get a total mass to print into the output. How would I go about doing so?
I can tell i’d need some sort of function that gets the locomotive model and all parts in it that is some sort of basepart that has a mass property (But consider, scripting is not my strong suit, but heres what I have so far, its not much though), I dont really know what im doing when it comes to stuff like this (its a shame im the only developer in my game lol)
local locomotive = script.Parent
function getMass(locomotive)
for i, v in pairs(locomotive) do
if i:IsA("BasePart") then
BasePart.Mass = "I dont even know what im doing"
print(totalmas?)
end
end
end
If anyone can help or has some useful solution please reply! (Edit: This script is in a local script located inside of the locomotive model