Back to Library
Utility Nov 23, 2025

Get Vehicle Mass

T
by terrorsoul

Gets the mass of the vehicle that the player is currently in

LUA
function GetVehicleMass(playerId)
    local structure = tm.players.OccupiedStructure(playerId)
    local totalMass = 0
    
    if structure ~= nil then
        local blocks = structure.GetBlocks()
        
        for _, block in pairs(blocks) do
            totalMass = totalMass + block.GetMass()
        end
    end
    
    return totalMass
end

Discussion

Please log in to post a comment.